Here you can find the source of toBits(long value, int length)
Parameter | Description |
---|---|
value | a parameter |
length | a parameter |
public static boolean[] toBits(long value, int length)
//package com.java2s; //License from project: Apache License public class Main { /**/*from w w w .ja va 2s . co m*/ * transform a long value into a boolean array * @param value * @param length * @return */ public static boolean[] toBits(long value, int length) { boolean[] bits = new boolean[length]; for (int i = length - 1; i >= 0; i--) { bits[i] = (value & (1 << i)) != 0; } return bits; } }