Here you can find the source of to_decimal(double v)
public static String to_decimal(double v)
//package com.java2s; /*/*from w w w . j a va 2 s. c o m*/ * Carrot2 project. * * Copyright (C) 2002-2016, Dawid Weiss, Stanis?aw Osi?ski. * All rights reserved. * * Refer to the full license file "carrot2.LICENSE" * in the root folder of the repository checkout or at: * http://www.carrot2.org/carrot2.LICENSE */ import java.text.NumberFormat; import java.util.Locale; public class Main { /** * Returns a decimal representation of a double * (no scientific notation used). */ public static String to_decimal(double v) { final NumberFormat nf = NumberFormat.getInstance(Locale.ENGLISH); nf.setMinimumFractionDigits(2); nf.setMaximumFractionDigits(4); return nf.format(v); } }