The samples provided in java doc https://download.java.net/java/early_access/jdk19/docs/api/java.base/java/lang/Long.html#compress(long,long) looks not resulting as it states.
For example :
Consider the simple case of compressing the digits of a hexadecimal value:
// Compressing drink to food
compress(0xCAFEBABE, 0xFF00FFF0) == 0xCABAB
The result is if(Long.compress(0xCAFEBABE, 0xFF00FFF0) == 0xCABAB){}
different.
And same for subsequent samples in case of Long
// Returns 1 if the bit at position n is one
compress(x, 1 << n) == (x >> n & 1)
// Logical shift right
compress(x, -1 << n) == x >>> n
....
But these samples works as stated in case of Integer.