fork download
  1. class Program {
  2. public static String toBin(Byte b) {
  3. String s1 = String.format("%8s", Integer.toBinaryString(b & 0xFF)).replace(' ', '0');
  4. return s1;
  5. }
  6.  
  7. public static void main(String[] args) {
  8. byte a = -8;
  9. System.out.println(Integer.toBinaryString(a));
  10. System.out.println(Integer.toBinaryString(a>>>1));
  11. System.out.println(toBin(a));
  12. a >>>= 1;
  13. System.out.println(toBin(a));
  14. }
  15. }
Success #stdin #stdout 0.07s 380160KB
stdin
Standard input is empty
stdout
11111111111111111111111111111000
1111111111111111111111111111100
11111000
11111100