Here you can find the source of intToByte(int number)
public static byte[] intToByte(int number)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] intToByte(int number) { byte[] b = new byte[4]; for (int i = 3; i >= 0; i--) { b[i] = (byte) (number % 256); number >>= 8;//from ww w . j ava 2 s. c om } return b; } }