Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

convert int ---> byte[]  RSS feed

 
m Taha
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone:
i wonder if i can convert or cast an int, float or even any Object to a byte array (byte[]) and vice-versa please help. thanx.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not automatically.
You have to code it by hand.

For the int you could use a String as intermediate, without occupying to much size, when most values are less than 9999.

Perhaps Serialization is the solution you could search for.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!