Java BigDecimal getIntLength(BigDecimal val)

Here you can find the source of getIntLength(BigDecimal val)

Description

The digit number of an integer part is acquired.

License

Open Source License

Parameter

Parameter Description
val The target value

Return

length The digit number of an integer portion

Declaration

private static int getIntLength(BigDecimal val) 

Method Source Code

//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();
    }
}

Related

  1. getFloatingPoint(Console console, Function validator)
  2. getFormattedBigDecimal(BigDecimal value)
  3. getFraction(BigDecimal b)
  4. getFractionalPart(BigDecimal value)
  5. getId(BigDecimal total, BigDecimal step)
  6. getIntValue(BigDecimal b)
  7. getLength(BigDecimal v)
  8. getLet(BigDecimal nl, BigDecimal el)
  9. getLetJp(BigDecimal nl)