Here you can find the source of bits2Numeric(boolean[] in)
Parameter | Description |
---|---|
in | a parameter |
public static int bits2Numeric(boolean[] in)
//package com.java2s; public class Main { /**//w w w. j av a 2s. co m * Converts a vector of booleans to a numeric representation. * * @param in * @return numeric representation of flag */ public static int bits2Numeric(boolean[] in) { int numeric = 0; for (int i = 0; i < in.length; i++) { if (in[i]) numeric += 1 << i; } return numeric; } }