Here you can find the source of binaryString2Long(String binString)
public static int binaryString2Long(String binString)
//package com.java2s; public class Main { public static int binaryString2Long(String binString) { int value = 0; int count = 1; for (int i = binString.length(); i > 0; i--) { if (Integer.parseInt(binString.substring(i - 1, i)) == 1) { value = value + count;//ww w.j av a2 s . co m } count = count * 2; } return value; } }