I have this small code :
public static void main(String[] args) {
byte[] bytesArray = {7,34};
BigInteger bytesTointeger= new BigInteger(bytesArray);
System.out.println(bytesTointeger);
}
Output:1826
My question is what just happened how an array of bytes {7,34} converted into this number 1826 , what is the operation that caused this result ? like how to convert it manually
The number 1826 is, in binary, 11100100010
.
If you split that in groups of 8 bits, you get the following:
00000111 00100010
Which are the numbers 7 and 34