Decompresses and returns a value from the specified byte array. @param array array @param pos position where the value is found @return decompressed value
(final byte[] array, final int pos)
| 78 | * @return decompressed value |
| 79 | */ |
| 80 | public static int get(final byte[] array, final int pos) { |
| 81 | int p = pos; |
| 82 | final int v = array[p++] & 0xFF; |
| 83 | return switch((v & 0xC0) >>> 6) { |
| 84 | case 0 -> v; |
| 85 | case 1 -> (v & 0x3F) << 8 | array[p] & 0xFF; |
| 86 | case 2 -> (v & 0x3F) << 24 | (array[p++] & 0xFF) << 16 | |
| 87 | (array[p++] & 0xFF) << 8 | array[p] & 0xFF; |
| 88 | default -> (array[p++] & 0xFF) << 24 | (array[p++] & 0xFF) << 16 | |
| 89 | (array[p++] & 0xFF) << 8 | array[p] & 0xFF; |
| 90 | }; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * Compresses and stores an integer value at the beginning of the byte array. |
no outgoing calls
no test coverage detected