class BitmapTools {

    public static byte[] packRGB565bytesToMono(final byte[] input) {
        if (input == null) return null;
        val output = new byte[input.length / 16 + (((input.length / 2) % 8 == 0) ? 0 : 1)];
        int bitPosition = 0;
        for (int i = 0; i < input.length; i = i + 2) {
            final int col = input[i] << 8 | input[i + 1];
            if (col != 0) { // any colour so long as its black
                output[bitPosition / 8] |= 1 << (bitPosition % 8);
            }
            bitPosition++;
        }
        return output;
    }

}