• Post Reply Bookmark Topic Watch Topic
  • New Topic

convert from decimal to byte array but base 8  RSS feed

 
Rob Chung
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any good way to convert a decimal number to 4 bytes in base 8?
eg. 127 in decimal = 00 00 00 7F
and 128 in decimal = 00 00 01 00
Thanks!
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try
Integer.valueOf("1234", 8).byteValue();
where the radix value is 8.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!