MCPcopy Create free account
hub / github.com/BaseXdb/basex / numDigits

Method numDigits

basex-core/src/main/java/org/basex/util/Token.java:436–443  ·  view source on GitHub ↗

Returns the number of digits of the specified integer. @param integer number to be checked @return number of digits

(final int integer)

Source from the content-addressed store, hash-verified

434 * @return number of digits
435 */
436 public static int numDigits(final int integer) {
437 int d = 1, i = integer;
438 if(i >= 100000000) { d += 8; i /= 100000000; }
439 if(i >= 10000) { d += 4; i /= 10000; }
440 if(i >= 100) { d += 2; i /= 100; }
441 if(i >= 10) d++;
442 return d;
443 }
444
445 /**
446 * Creates a token representation from the specified long value,

Callers 2

tokenMethod · 0.95
unpackLengthMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected