Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { /** * Converts an array of bits (represented with integers) to an integer. * * This method is mainly used to decode the margin of an encoded image. * * @param binaryList An array of integers which represents a number in binary format * @return The converted integer */ public static int getIntegerBinaryList(ArrayList<Integer> binaryList) { StringBuilder binaryString = new StringBuilder(); for (Integer currentBit : binaryList) { binaryString.append(currentBit); } return Integer.parseInt(binaryString.toString(), 2); } }