Here you can find the source of toInt(double[] layer)
public static int toInt(double[] layer)
//package com.java2s; //License from project: Open Source License public class Main { public static int toInt(double[] layer) { return toInt(layer, 0, layer.length); }//from w w w . j a v a 2 s .c o m public static int toInt(double[] layer, int si, int ei) { int ret = 0; for (int i = si; i < ei; i++) { ret *= 2; if (layer[i] >= 0.5) { ret++; } } return ret; } }