Skip to content

Instantly share code, notes, and snippets.

@mbchoa
Created March 26, 2015 00:03
Show Gist options
  • Save mbchoa/d29b3c9a4c6643362d99 to your computer and use it in GitHub Desktop.
Save mbchoa/d29b3c9a4c6643362d99 to your computer and use it in GitHub Desktop.
Find the number of digits in an integer
for(long long int temp = number; temp >= 1;)
{
temp/=10;
decimalPlaces++;
}
String s = new Integer(t).toString();
int len = s.length();
int digits = (int)(Math.log(integer) / Math.log(10) + 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment