Here you can find the source of intTo4Byte(int i)
public static byte[] intTo4Byte(int i)
//package com.java2s; /**// ww w . ja v a 2 s .c om * License * * Licensed under the GNU GPL v3 * http://www.gnu.org/licenses/gpl.html * */ public class Main { public static byte[] intTo4Byte(int i) { return numberToByte(i, 4); } private static byte[] numberToByte(long l, int length) { byte[] bts = new byte[length]; for (int i = 0; i < length; i++) { bts[i] = (byte) (l >> ((length - i - 1) * 8)); } return bts; } }