Java BigDecimal to bigDecimalToString(BigDecimal dec)

Here you can find the source of bigDecimalToString(BigDecimal dec)

Description

big Decimal To String

License

Apache License

Declaration

public static String bigDecimalToString(BigDecimal dec) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

public class Main {
    public static String bigDecimalToString(BigDecimal dec) {
        if (dec == null) {
            return "0";
        }/*from   www .  ja va2  s  . c  om*/
        if (dec.toString().length() < 10) {
            return dec.toString();
        }
        return dec.toString().substring(0, 10) + dec.toString().substring(dec.toString().length() - 6);
    }
}

Related

  1. bigDecimaltoJSONString(Object obj)
  2. bigDecimalToLong(BigDecimal bigDecimal)
  3. bigDecimalToLong(BigDecimal value)
  4. bigDecimalToStellarBalance(final BigDecimal balance)
  5. bigDecimalToString(BigDecimal bigDecimal)
  6. convertBigDecimalTodouble(BigDecimal bigDecimalVal)
  7. convertBigDecimalToSQLBigNum(BigDecimal bd, int targetLength, int targetScale)
  8. convertBigDecimalToString(BigDecimal bigValue)
  9. convertDoubleToBigDecimal(Double value)