Java Double Number Format toString(double in, String format)

Here you can find the source of toString(double in, String format)

Description

to String

License

Apache License

Declaration

public static String toString(double in, String format) 

Method Source Code

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

import java.text.DecimalFormat;

public class Main {
    public static String toString(Object[] in) {
        StringBuffer desc = new StringBuffer();
        desc.append("[");
        if (in != null) {
            for (int i = 0; i < in.length; i++) {
                desc.append(in[i]).append(";");
            }//from   w w  w.ja  va 2  s. c  o  m
        }
        desc.append("]");
        return desc.toString();
    }

    public static String toString(double in, String format) {
        DecimalFormat formatter = new DecimalFormat(format);
        return formatter.format(in);
    }

    public static String toString(int in, String format) {
        DecimalFormat formatter = new DecimalFormat(format);

        return formatter.format(in);
    }
}

Related

  1. isDoubleWhitFormat(String pValue)
  2. prettyDecimalFormat(double d, int numPlaces)
  3. roundFormat(double d, int i)
  4. shorten(double num)
  5. toDoubleFromHumanFormat(String doubleAsString)
  6. toString(double[] arr, NumberFormat nf)
  7. toString(double[] y, Format format)