Here you can find the source of fromInt(int value)
public static byte[] fromInt(int value)
//package com.java2s; //License from project: Open Source License public class Main { public static byte[] fromInt(int value) { return fromLong(value, 4); }//from w ww . j a va2 s. co m public static byte[] fromLong(long value, int numBytes) { long mask = 0xFF; byte[] res = new byte[numBytes]; for (int i = 0; i < numBytes; i++) { res[i] = (byte) (value & mask); value = value >> 8; } return res; } }