public static byte[] intToByteArray(int value) {

byte[] byteArray = new byte[4];

byteArray[0] = (byte) (value >> 24);

byteArray[1] = (byte) (value >> 16);

byteArray[2] = (byte) (value >> 8);

byteArray[3] = (byte) (value);

return byteArray;

}


public static int byteArrayToInt(byte bytes[]) {

return ((((int) bytes[0] & 0xff) << 24) | (((int) bytes[1] & 0xff) << 16) | (((int) bytes[2] & 0xff) << 8)

| (((int) bytes[3] & 0xff)));

}





위에가 int를 byte로 바꾸는 건데

쉬프트연산 24개, 16개, 8개, 걍 납두면 왜 바이트로 바뀌는거예요?



쉬프트연산 24, 16, 8, 0 이랑 


0xff는 무슨 연관이 있길래 이걸 연산이라고 하는거죠?



살짝만 값 넣어줘둬


답 이상하게 음수 100백만 뜨던데