Here you can find the source of charArrayToLong(char[] bi)
public static long charArrayToLong(char[] bi)
//package com.java2s; //License from project: Apache License public class Main { /**//from w ww . j a va2s. com * * change from char array to long * @param bi * @return long * @throws */ public static long charArrayToLong(char[] bi) { long len = bi.length; long sum = 0; long tmp, max = len - 1; for (int i = 0; i < len; ++i) { tmp = bi[i] - '0'; sum += tmp * Math.pow(2, max--); } return sum; } }