Here you can find the source of booleanToShort(boolean[] values)
public static short[] booleanToShort(boolean[] values)
//package com.java2s; public class Main { public static short[] booleanToShort(boolean[] values) { if (values == null) { return null; }/*from w w w . ja v a 2 s. co m*/ short[] results = new short[values.length]; for (int i = 0; i < values.length; i++) { results[i] = (short) (values[i] == true ? 1 : 0); } return results; } }