getDecimalLength static method

int getDecimalLength(
  1. double b
)

Implementation

static int getDecimalLength(double b) {
  String s = b.toString();
  int dotIndex = s.indexOf(".");
  if (dotIndex < 0) {
    return 0;
  } else {
    return s.length - dotIndex - 1;
  }
}