| 1 | package emu.grasscutter.utils; |
| 2 | |
| 3 | public class ByteHelper { |
| 4 | public static byte[] changeBytes(byte[] a) { |
| 5 | byte[] b = new byte[a.length]; |
| 6 | for (int i = 0; i < a.length; i++) { |
| 7 | b[i] = a[a.length - i - 1]; |
| 8 | } |
| 9 | return b; |
| 10 | } |
| 11 | |
| 12 | public static byte[] longToBytes(long x) { |
| 13 | byte[] bytes = new byte[8]; |
| 14 | bytes[0] = (byte) (x >> 56); |
| 15 | bytes[1] = (byte) (x >> 48); |
| 16 | bytes[2] = (byte) (x >> 40); |
| 17 | bytes[3] = (byte) (x >> 32); |
| 18 | bytes[4] = (byte) (x >> 24); |
| 19 | bytes[5] = (byte) (x >> 16); |
| 20 | bytes[6] = (byte) (x >> 8); |
| 21 | bytes[7] = (byte) (x); |
| 22 | return bytes; |
| 23 | } |
| 24 | } |
nothing calls this directly
no outgoing calls
no test coverage detected