Java Boolean to Short booleanToShort(boolean[] values)

Here you can find the source of booleanToShort(boolean[] values)

Description

boolean To Short

License

Open Source License

Declaration

public static short[] booleanToShort(boolean[] values) 

Method Source Code

//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;
    }
}

Related

  1. boolean2Short(boolean pBool)
  2. booleanToShort(boolean b)
  3. booleanToshort(final boolean value)