Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.NumberFormat;

public class Main {
    public static String getNumberWithFractionDigit(double value, int fracLength) {
        NumberFormat nf = NumberFormat.getInstance();

        nf.setMaximumFractionDigits(fracLength);
        nf.setMinimumFractionDigits(fracLength);

        return nf.format(value);
    }
}