// a java code that extracts a set of binary strings 6 bits at a time
import java.util.Scanner;
public class Demo {
static int bitExtracted(int number, int k, int p)
{
return (((1 << k) - 1) & (number >> (p - 1)));
}
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
String binary = "";
int x, number = 114, k = 6, p = 1;
x = bitExtracted(number, k, p);
while (x != 0) {
int remainder = x % 2;
binary = remainder + binary;
x = x / 2;
}
System.out.println("The extracted number is "+"(" +x +")"+": "+ binary);
}
}