Code example for DecimalFormat

Methods: format, parse

0
     * @param coordinate unformatted coordinate 
     * @param df format 
     * @return formatted coordinate or origin coordinate if parse exception occurs 
     */ 
    public static Number formatCoordinate(double coordinate, DecimalFormat df){
        String format = df.format(coordinate);
        try{ 
            return df.parse(format);
        }catch (ParseException pe){
            return coordinate;
        } 
    } 
 
    private LocatorException generateLocatorException(Failure failure){
          String message = this.getErrorString(failure);
           return new LocatorException(failure,message);
    } 
    public enum Failure { 
        /** 
         * Result which indicates that parameter passed to method is NULL 
         */