Java Double to String double2str(double amount, int length)

Here you can find the source of double2str(double amount, int length)

Description

doublestr

License

Open Source License

Declaration

public static String double2str(double amount, int length) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static String double2str(double amount, int length) {
        String strAmt = Double.toString(amount);

        int pos = strAmt.indexOf('.');

        if (pos != -1 && strAmt.length() > length + pos + 1)
            strAmt = strAmt.substring(0, pos + length + 1);

        return strAmt;
    }//from  www.  ja va  2  s.co  m
}

Related

  1. convertDoubleToString(double value)
  2. convertDoubleToString(double value)
  3. double2str(double d, int noOfDecimalDigit)
  4. double2string(double doubledata)
  5. double2String(double[] v)
  6. doubleToStr(Double d)