Here you can find the source of ToInt(short n1, short n2)
public static int ToInt(short n1, short n2)
//package com.java2s; //License from project: Apache License public class Main { public static int ToInt(short n1, short n2) { byte[] bytes = new byte[4]; bytes[1] = (byte) (n1 & 0xff); bytes[0] = (byte) ((n1 >> 8) & 0xff); bytes[3] = (byte) (n2 & 0xff); bytes[2] = (byte) ((n2 >> 8) & 0xff); return ToInt(bytes); }/*from w w w . j a va 2 s .c o m*/ public static int ToInt(byte bytes[]) { return (bytes[3] & 0xff | (bytes[2] & 0xff) << 8 | (bytes[1] & 0xff) << 16 | (bytes[0] & 0xff) << 24); } public static int ToInt(byte bytes[], int offset) { return (bytes[offset + 3] & 0xff | (bytes[offset + 2] & 0xff) << 8 | (bytes[offset + 1] & 0xff) << 16 | (bytes[offset] & 0xff) << 24); } }