protected static String doubleToString(double num){
  long whole=(long)num;
  if (whole == Long.MAX_VALUE || whole == Long.MIN_VALUE) {
    return Double.toString(whole);
  }
  double fract=Math.abs(num - whole);
  String res=Long.toString(whole);
  if (fract != 0.0) {
    String f2s=Double.toString(fract + 1.0);
    res+=f2s.substring(1);
  }
  return res;
}

protected static String doubleToString ( double num ) { long whole = ( long ) num ; if ( whole == Long . MAX_VALUE || whole == Long . MIN_VALUE ) { return Double . toString ( whole ) ; } double fract = Math . abs ( num - whole ) ; String res = Long . toString ( whole ) ; if ( fract != 0.0 ) { String f2s = Double . toString ( fract + 1.0 ) ; res += f2s . substring ( 1 ) ; } return res ; }
converts a double to string with maximum precision .
