java/util

[java] - byte array to int

짱가쟁이 2010. 6. 29. 17:27
public static int byteToInt(byte[] src) {

        int newValue = 0;

        newValue |= (((int)src[0])<<24)&0xFF000000;
        newValue |= (((int)src[1])<<16)&0xFF0000;
        newValue |= (((int)src[2])<<8)&0xFF00;
        newValue |= (((int)src[3]))&0xFF;

        DebugPrint.writeDebug("aaaa : " + newValue);
      
        return newValue;
}