Here you can find the source of isBitSet(byte[] arr, int bit)
public static boolean isBitSet(byte[] arr, int bit)
//package com.java2s; public class Main { public static boolean isBitSet(byte[] arr, int bit) { int index = bit / 8; // Get the index of the array for the byte with this bit int bitPosition = bit % 8; // Position of this bit in a byte return (arr[index] >> bitPosition & 1) == 1; }//from w ww . j ava 2 s . com }