Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.text.DecimalFormat;

public class Main {
    public static final DecimalFormat decimalFormat = new DecimalFormat("#,###,###.##");

    public static String getDecimalString(String value) {

        try {
            double result = Double.parseDouble(value); // Make use of autoboxing.  It's also easier to read.
            String output = decimalFormat.format(result);
            return output;
        } catch (NumberFormatException e) {
            // value did not contain a valid double
            return "";
        }
        //        return "" + (value != null ? decimalFormat.format(value) : "");
    }
}