use right shift

This commit is contained in:
Shaojin Wen 2025-06-12 19:45:40 +08:00
parent 515ffa092b
commit 8a30d2ec75

View File

@ -315,7 +315,7 @@ public final class Long extends Number
*/
public static String toHexString(long i) {
int mag = Long.SIZE - Long.numberOfLeadingZeros(i);
int len = Math.max(((mag + 3) / 4), 1);
int len = Math.max(((mag + 3) >> 2), 1);
long x = HexDigits.hex8(i);
if (COMPACT_STRINGS) {
byte[] chars = new byte[len];