Java examples for File Path IO:Byte Array
get Bit from Byte value
//package com.java2s; public class Main { public static void main(String[] argv) throws Exception { byte b = 2; int pos = 2; System.out.println(getBit(b, pos)); }/* ww w . j ava2 s. c o m*/ /** * * @param b * @param pos * @return */ public static boolean getBit(byte b, int pos) { return (b & (1 << pos)) > 0; } }