Converting int array to byte array
I am attempting to convert an array of ints to a byte array to store in a file which will later be read and converted back into an int array.
these are my conversion methods:
7 Replies
ā
This post has been reserved for your question.
Hey @špothicon! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
this is a test I did to see if my methods work
-2 billion is turning into -16 million
not sure what i did wrong
try removing the
& 0xFF
or use parenthesis
x & 0xFF << 24
is x & (0xFF << 24)
but you want (x & 0xFF) << 24
same with the othersah
yep that was it thanks
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@465515365108154380>.