Example #1
0
  public byte[] byteSerialize() {

    byte[] face = ArrayUtil.intToByteArray(f.val());
    byte[] dir = ArrayUtil.intToByteArray(d.val());
    byte[] s = ArrayUtil.intToByteArray(slice);
    return ArrayUtil.concatenateArrays(face, dir, s);
  }
Example #2
0
 public static Twist byteDeserialize(byte[] src) {
   int face = ArrayUtil.byteArrayToInt(Arrays.copyOfRange(src, 0, 4));
   int dir = ArrayUtil.byteArrayToInt(Arrays.copyOfRange(src, 4, 8));
   int s = ArrayUtil.byteArrayToInt(Arrays.copyOfRange(src, 8, 12));
   return createTwist(Face.getFace(face), Dir.getDir(dir), s);
 }