Java tutorial
//package com.java2s; public class Main { private static byte bits2byte(String bString) { byte result = 0; for (int i = bString.length() - 1, j = 0; i >= 0; i--, j++) { result += (Byte.parseByte(bString.charAt(i) + "") * Math.pow(2, j)); } return result; } }