Here you can find the source of toBytes(int i)
public static byte[] toBytes(int i)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] toBytes(int i) { byte[] result = new byte[4]; result[0] = (byte) (i >> 24); result[1] = (byte) (i >> 16); result[2] = (byte) (i >> 8); result[3] = (byte) (i /* >> 0 */); return result; }//from w w w .j av a 2 s . co m }