Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

385
Views
Cómo agregar bytes a ByteArray en Kotlin

Soy un principiante en Kotlin y estaba tratando de agregar bytes al final de un ByteArray . Cómo puedo hacer eso ?

Aquí hay una forma en que lo intenté. ¿Se ve bien?

 var someByteArray = byteArrayOf(*payload, 0x01.toByte())

donde la payload es un ByteArray

Su ayuda es muy apreciada

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

ByteArray sobrecarga el operador plus , por lo que puede agregar directamente al valor anterior o asignarlo a una nueva matriz. Por ejemplo:

 val startArray = byteArrayOf(0x1, 0x2, 0x3) val newArray = startArray + 0x4.toByte()

O si desea mantener la var mutable, simplemente puede asignarla más:

 var array = byteArrayOf(0x1, 0x2, 0x3) array += 0x4.toByte()
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!