Skip to content

Commit 044d463

Browse files
committed
Clarified parsing of hex as unsigned in fromHexDigits methods.
1 parent af7b1fa commit 044d463

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/java.base/share/classes/java/util/HexFormat.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,8 @@ private int fromHexDigits(CharSequence string, int index) {
927927
/**
928928
* Returns the {@code int} value parsed from a string of up to eight hexadecimal characters.
929929
* The hexadecimal characters are parsed from most significant to least significant
930-
* using {@link #fromHexDigit(int)}.
930+
* using {@link #fromHexDigit(int)} to form an unsigned value.
931+
* The value is zero extended to 32 bits and is returned as an {@code int}.
931932
* The delimiter, prefix, suffix, and uppercase parameters are not used.
932933
*
933934
* @apiNote
@@ -957,7 +958,9 @@ public int fromHexDigits(CharSequence string) {
957958
* Returns the {@code int} value parsed from a string range of up to eight hexadecimal
958959
* characters.
959960
* The characters in the range {@code fromIndex} to {@code toIndex}, exclusive,
960-
* are parsed from most significant to least significant using {@link #fromHexDigit(int)}.
961+
* are parsed are parsed from most significant to least significant
962+
* using {@link #fromHexDigit(int)} to form an unsigned value.
963+
* The value is zero extended to 32 bits and is returned as an {@code int}.
961964
* The delimiter, prefix, suffix, and uppercase parameters are not used.
962965
*
963966
* @apiNote
@@ -991,7 +994,9 @@ public int fromHexDigits(CharSequence string, int fromIndex, int toIndex) {
991994
/**
992995
* Returns the long value parsed from a string of up to sixteen hexadecimal characters.
993996
* The hexadecimal characters are parsed from most significant to least significant
994-
* using {@link #fromHexDigit(int)}.
997+
* using {@link #fromHexDigit(int)} to form an unsigned value.
998+
* The value is zero extended to 64 bits and is returned as a {@code long}.
999+
9951000
* The delimiter, prefix, suffix, and uppercase parameters are not used.
9961001
*
9971002
* @apiNote
@@ -1021,7 +1026,9 @@ public long fromHexDigitsToLong(CharSequence string) {
10211026
* Returns the long value parsed from a string range of up to sixteen hexadecimal
10221027
* characters.
10231028
* The characters in the range {@code fromIndex} to {@code toIndex}, exclusive,
1024-
* are parsed from most significant to least significant using {@link #fromHexDigit(int)}.
1029+
* parsed from most significant to least significant
1030+
* using {@link #fromHexDigit(int)} to form an unsigned value.
1031+
* The value is zero extended to 64 bits and is returned as a {@code long}.
10251032
* The delimiter, prefix, suffix, and uppercase parameters are not used.
10261033
*
10271034
* @apiNote

0 commit comments

Comments
 (0)