convert two bytes to int java

Java
int val = ((bytes[2] & 0xff) << 8) | (bytes[3] & 0xff);
Source

Also in Java: