public static String consistentToString(BigDecimal decimal){
  if (decimal == null) {
    return null;
  }
  if (toPlainStringMethod != null) {
    try {
      return (String)toPlainStringMethod.invoke(decimal,(Object[])null);
    }
 catch (    InvocationTargetException invokeEx) {
    }
catch (    IllegalAccessException accessEx) {
    }
  }
  return decimal.toString();
}

public static String consistentToString ( BigDecimal decimal ) { if ( decimal == null ) { return null ; } if ( toPlainStringMethod != null ) { try { return ( String ) toPlainStringMethod . invoke ( decimal , ( Object [ ] ) null ) ; } catch ( InvocationTargetException invokeEx ) { } catch ( IllegalAccessException accessEx ) { } } return decimal . toString ( ) ; }
takes care of the fact that sun changed the output of bigdecimal . tostring ( ) between jdk - 1 . 4 and jdk 5
