Here you can find the source of IntToBytes4(int i)
public static byte[] IntToBytes4(int i)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] IntToBytes4(int i) { byte abyte0[] = new byte[4]; abyte0[3] = (byte) (0xff & i); abyte0[2] = (byte) ((0xff00 & i) >> 8); abyte0[1] = (byte) ((0xff0000 & i) >> 16); abyte0[0] = (byte) ((0xff000000 & i) >> 24); return abyte0; }/* ww w . jav a 2 s. c o m*/ public static void IntToBytes4(int i, byte abyte0[]) { abyte0[3] = (byte) (0xff & i); abyte0[2] = (byte) ((0xff00 & i) >> 8); abyte0[1] = (byte) ((0xff0000 & i) >> 16); abyte0[0] = (byte) (int) ((0xffffffffff000000L & (long) i) >> 24); } }