How does this print “hello world”?

后端 未结 9 1332
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:03

    You are getting a result which happens to be char representation of below values

    104 -> h
    101 -> e
    108 -> l
    108 -> l
    111 -> o
    32  -> (space)
    119 -> w
    111 -> o
    114 -> r
    108 -> l
    100 -> d
    

提交回复
热议问题