Here you can find the source of int2bytes(int num)
public static byte[] int2bytes(int num)
//package com.java2s; //License from project: Apache License public class Main { public static byte[] int2bytes(int num) { byte[] bytes = new byte[] { (byte) (num >> 24), (byte) (num >> 16), (byte) (num >> 8), (byte) (num) }; return bytes; }//from ww w. java2 s. c o m }