3

I have stored an integer value into 4 bytes and I have trouble converting it back into integer.

byte[] pom = ByteBuffer.allocate(4).putInt(60000).array();

In each byte I have an hexadecimal part of my int number.

arr[0] = 0
arr[1] = 0
arr[2] = ea
arr[3] = 60

How can I convert it back into integer?

0

1 Answer 1

15

Just use ByteBuffer.getInt():

int pomAsInt = ByteBuffer.wrap(pom).getInt();
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.