Here you can find the source of binaryToInt(String binary, int intlength)
public static String binaryToInt(String binary, int intlength)
//package com.java2s; public class Main { public static String binaryToInt(String binary, int intlength) { String s = Integer.parseInt(binary, 2) + ""; while ((s + "").length() < intlength) { s = "0" + s; }/*from ww w . j a v a2 s. c o m*/ return s; } }