Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();
System.out.println(input);
int a = Integer.parseInt(input.substring(2), 16);
System.out.println(Integer.toBinaryString(a));
Above mentioned code that takes in hex value and convert it into binary. However, this would not work on input "0xBE400000
" but it works fine for "0x41C20000
"