TheBook TheBook - 28 days ago 4x
Java Question

Initialize byte[] in java

I have seen the following byte initialization in a tutorial. I just want to ask whether the array includes 17 bytes after initialization and if yes why did he not use 11 hexadecimal to get a decimal value of 17?

byte[] decoded = new byte[0x0f + 2];


Yes, the array will have a length of 17 bytes.

As to why the programmer did this, it's impossible to know from what you've posted. My guess is that 0x0f has a special meaning within the application and the + 2 is two bytes of additional buffer space and 2 also has some special meaning.