I saw this sentence, but I can't understand this sentence very well. Can someone explain?
Help VM constant-fold; MAX_HIGH_SURROGATE + 1 == MIN_LOW_SURROGATE
This sentence comes from the code below:
/**
* Determines if the given {@code char} value is a
* <a href="http://www.unicode.org/glossary/#high_surrogate_code_unit">
* Unicode high-surrogate code unit</a>
* (also known as <i>leading-surrogate code unit</i>).
*
* <p>Such values do not represent characters by themselves,
* but are used in the representation of
* <a href="#supplementary">supplementary characters</a>
* in the UTF-16 encoding.
*
* @param ch the {@code char} value to be tested.
* @return {@code true} if the {@code char} value is between
* {@link #MIN_HIGH_SURROGATE} and
* {@link #MAX_HIGH_SURROGATE} inclusive;
* {@code false} otherwise.
* @see Character#isLowSurrogate(char)
* @see Character.UnicodeBlock#of(int)
* @since 1.5
*/
public static boolean isHighSurrogate(char ch) {
// Help VM constant-fold; MAX_HIGH_SURROGATE + 1 == MIN_LOW_SURROGATE
return ch >= MIN_HIGH_SURROGATE && ch < (MAX_HIGH_SURROGATE + 1);
}
I understand 'constant-fold', but How does this line of code relate to constant folding?
And , source code comes from Class 'Character'.
Constant value:
MIN_HIGH_SURROGATE = '\uD800'; MAX_HIGH_SURROGATE = '\uDBFF'