Java BigDecimal Format formatUnwithE(Object arg)

Here you can find the source of formatUnwithE(Object arg)

Description

DOC Administrator Comment method "formatUnwithE".

License

Open Source License

Parameter

Parameter Description
arg like: double falot String .... e.g:1.0E-8

Return

0.00000001 as String

Declaration

public static String formatUnwithE(Object arg) 

Method Source Code


//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

import java.math.BigDecimal;

public class Main {
    /**//w w  w .j  a  v  a 2s. c  om
     * DOC Administrator Comment method "formatUnwithE". In java when double more than six decimal that use toString
     * will rentru contains E scientific natation.
     *
     * @param arg like: double falot String .... e.g:1.0E-8
     * @return 0.00000001 as String
     */
    public static String formatUnwithE(Object arg) {
        String doubleString = String.valueOf(arg);
        int index = doubleString.indexOf("E");
        if (index != -1) {
            return (new BigDecimal(doubleString)).toPlainString();
        }
        return doubleString;
    }
}

Related

  1. formatStore(long store)
  2. formattedFromBigDecimal(BigDecimal number, int scale, Locale locale)
  3. formattedToBigDecimal(String str, Locale locale)
  4. formatTime(BigDecimal seconds)
  5. formatTwoDecimals(float num)
  6. formatYuan2Fen(double fee)
  7. getFormatSizeByKB(long size)
  8. isLess(float formateValue1, float formateValue2)
  9. timeToEMTFormat(long elapsedTimeMillis)