Returns a "Java hash code" for this HashCode instance; this is well-defined (so, for example, you can safely put HashCode instances into a HashSet) but is otherwise probably not what you want to use.
()
| 401 | */ |
| 402 | |
| 403 | @Override |
| 404 | public final int hashCode() { |
| 405 | // If we have at least 4 bytes (32 bits), just take the first 4 bytes. Since this is |
| 406 | // already a (presumably) high-quality hash code, any four bytes of it will do. |
| 407 | if (bits() >= 32) { |
| 408 | return asInt(); |
| 409 | } |
| 410 | // If we have less than 4 bytes, use them all. |
| 411 | |
| 412 | |
| 413 | byte[] bytes = getBytesInternal(); |
| 414 | int val = (bytes[0] & 0xFF); |
| 415 | for (int i = 1; i < bytes.length; i++) { |
| 416 | val |= ((bytes[i] & 0xFF) << (i * 8)); |
| 417 | } |
| 418 | return val; |
| 419 | } |
| 420 | |
| 421 | /** |
| 422 | * Returns a string containing each byte of {@link #asBytes}, in order, as a two-digit unsigned |
nothing calls this directly
no test coverage detected