private static String createMessage(String fieldName, Number value,
                                        Number lowerBound, Number upperBound, String explain) {
        StringBuilder buf = new StringBuilder()
            .append("Value ").append(value).append(" for ").append(fieldName).append(' ');

        if (lowerBound == null) {
            if (upperBound == null) {
                buf.append("is not supported");
            } else {
                buf.append("must not be larger than ").append(upperBound);
            }
        } else if (upperBound == null) {
            buf.append("must not be smaller than ").append(lowerBound);
        } else {
            buf.append("must be in the range [")
                .append(lowerBound)
                .append(',')
                .append(upperBound)
                .append(']');
        }
        if (explain != null) {
            buf.append(": ").append(explain);
        }

        return buf.toString();
    }
private static String createMessage ( String fieldName , Number value , Number lowerBound , Number upperBound , String explain ) { StringBuilder buf = new StringBuilder ( ) . append ( "Value " ) . append ( value ) . append ( " for " ) . append ( fieldName ) . append ( ' ' ) ; if ( lowerBound == null ) { if ( upperBound == null ) { buf . append ( "is not supported" ) ; } else { buf . append ( "must not be larger than " ) . append ( upperBound ) ; } } else if ( upperBound == null ) { buf . append ( "must not be smaller than " ) . append ( lowerBound ) ; } else { buf . append ( "must be in the range [" ) . append ( lowerBound ) . append ( ',' ) . append ( upperBound ) . append ( ']' ) ; } if ( explain != null ) { buf . append ( ": " ) . append ( explain ) ; } return buf . toString ( ) ; }
Creates a message for the exception.

@param fieldName  the field name
@param value  the value rejected
@param lowerBound  the lower bound allowed
@param upperBound  the upper bound allowed
@param explain  an explanation
@return the message