fork(1) download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. long a = (0x011233l) << 24 | 0x455677;
  13. long b = (0x233455l) << 24 | 0x677011;
  14. System.out.printf("a: %x b: %x \n", a, b);
  15. if (b == a)
  16. System.out.printf(" bingo at zero digits shift \n");
  17. for (int sh=4; sh<48; sh+=4) {
  18. long bb = (b >> sh)|((b << (64 - sh))>>16);
  19. System.out.printf("rotated %d bits bb: %x \n", sh, bb);
  20. if (bb == a)
  21. System.out.printf(" bingo at %d digits shift \n", sh/4);
  22. }
  23. // your code goes here
  24. }
  25. }
Success #stdin #stdout 0.05s 2184192KB
stdin
Standard input is empty
stdout
a: 11233455677   b: 233455677011  
rotated 4 bits  bb: 123345567701 
rotated 8 bits  bb: 112334556770 
rotated 12 bits  bb: 11233455677 
 bingo at 3 digits shift 
rotated 16 bits  bb: 701123345567 
rotated 20 bits  bb: 770112334556 
rotated 24 bits  bb: 677011233455 
rotated 28 bits  bb: 567701123345 
rotated 32 bits  bb: 556770112334 
rotated 36 bits  bb: 455677011233 
rotated 40 bits  bb: 345567701123 
rotated 44 bits  bb: 334556770112