Here you can find the source of intToBinary(int i, int byteLength)
public static String intToBinary(int i, int byteLength)
//package com.java2s; public class Main { public static String intToBinary(int i, int byteLength) { String binString = Integer.toBinaryString(i); while (binString.length() < byteLength * 8) { binString = "0" + binString; }/*from ww w . java 2 s . com*/ return binString; } }