I'm new to Groovy. When I want convert some integer number to hex string, I have tried codes like this:
theNumber.toString(16)
as what I did in JavaScript. (Groovy is just like yet another script language looks similar to Java, right?)
But the code above not work as my expected. When the number is very large, the result is correct; but most of the time, it just return 16.
println(256.toString(16)) // 16
println(36893488147419103232.toString(16)) // 20000000000000000
I'm confused why Groovy behavior such strange. Could anyone help me to explain this? And, what is the best way to convert integer number to hex string?
Thanks.