Question about array of byte?

there is an array of byte ((3 235) , (225 7)).
according to the principle of int(is 2 byte).
how to convert a byte array to an int what would happen((1003) , (2017))?
June 27th 19 at 15:24
1 answer
June 27th 19 at 15:26
Solution
int is 4 bytes, not 2.

But I can put in this way:
int i = 0;

byte b1 = 3; // 11
byte b2 = 5; // 101

i = i | b1;
i = i << 8;
i = i | b2;

System.out.println(i);


Just keep in mind that Java has no unsigned types, so `byte b = 235` can be).

Find more questions by tags Java