Here you can find the source of getIntLength(BigDecimal val)
Parameter | Description |
---|---|
val | The target value |
private static int getIntLength(BigDecimal val)
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; import java.math.BigInteger; public class Main { /**/*from w ww. ja v a 2s . com*/ * The digit number of an integer part is acquired. * * @param val The target value * @return length The digit number of an integer portion */ private static int getIntLength(BigDecimal val) { BigInteger intVal = val.unscaledValue(); intVal = intVal.abs(); String bak = intVal.toString(); return bak.length(); } }