Here you can find the source of toBytes(int i)
public static byte[] toBytes(int i)
//package com.java2s; public class Main { public static byte[] toBytes(int i) { byte[] b = new byte[4]; b[0] = (byte) (i & 0xff); b[1] = (byte) ((i & 0xff00) >> 8); b[2] = (byte) ((i & 0xff0000) >> 16); b[3] = (byte) ((i & 0xff000000) >> 24); return b; }/*ww w. j av a2s. c o m*/ }