Here you can find the source of truncDouble(double val)
public static String truncDouble(double val)
//package com.java2s; public class Main { public static String truncDouble(double val) { return String.valueOf(val).replaceAll("0+$", "").replaceAll("\\.$", ""); }/*from w w w . j ava 2 s .c o m*/ }