How does this print “hello world”?

后端 未结 9 1528
Happy的楠姐
Happy的楠姐 2021-01-29 17:33

I discovered this oddity:

for (long l = 4946144450195624l; l > 0; l >>= 5)
    System.out.print((char) (((l & 31 | 64) % 95) + 32));
9条回答
  •  悲&欢浪女
    2021-01-29 18:10

    I found the code slightly easier to understand when translated into PHP, as follows:

     0; $bignum >>= 5){
        $result = (( $bignum & 31 | 64) % 95) + 32;
        echo chr($result);
    }
    

    See live code

提交回复
热议问题