Here you can find the source of format(int decs, double number)
Parameter | Description |
---|---|
decs | Decimal numbers to display |
number | The number to format |
public static String format(int decs, double number)
//package com.java2s; //License from project: Open Source License public class Main { /**// w ww .ja v a 2 s. c o m * Formats a number to a given amount of decimal places. * * @param decs Decimal numbers to display * @param number The number to format * @return Formatted number String */ public static String format(int decs, double number) { return String.format("%." + decs + "f", number); } }