Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.DecimalFormat;

public class Main {

    public static String formatNumber2D(double value) {
        return formatNumber(value, "0.00");
    }

    public static String formatNumber(double value, String format) {
        DecimalFormat decimalFormat = new DecimalFormat(format);
        return decimalFormat.format(value);
    }

    public static String formatNumber(double value) {
        return formatNumber(value, "0");
    }
}