Here you can find the source of int2zpBin(BigInteger num, int len)
public static String int2zpBin(BigInteger num, int len)
//package com.java2s; //License from project: BSD License import java.math.BigInteger; public class Main { public static String int2zpBin(int num, int len) { final String zeroPadding = rep('0', len); final String numString = Integer.toBinaryString(num); return (zeroPadding.substring(numString.length()) + numString); }/*from w w w . ja va 2 s. c om*/ public static String int2zpBin(BigInteger num, int len) { final String zeroPadding = rep('0', len); final String numString = num.toString(2); return (zeroPadding.substring(numString.length()) + numString); } public static String rep(char c, int n) { return new String(new char[n]).replace('\0', c); } }