I have a random number such as 35 127 3658 45782 etc... I want to round them to 10^ form like 10 100 1000 10000. I can do it with this code:
Math.pow(10, (int)(Math.log10(number)) + 1);
But this code seems to me a bit complex and long for basic operation like that. Is there a better way to do it?
Aucun commentaire:
Enregistrer un commentaire