@Override public State unpack(PackedElement packed) { assert packed.getLongsCount() == 1; long firstPacked = packed.getFirst(); TopSpinState tss = new TopSpinState(); // Start from end and go to start for (int i = this.tokensNumber - 1; i >= 0; --i) { // Each time, extract a single token int t = (int) firstPacked & 0xF; // Initialize this token tss.tokens[i] = t; // Update the word so that the next tile can be now extracted firstPacked >>= 4; } double[] hd = this._computeHD(tss); tss.h = hd[0]; tss.d = hd[1]; return tss; }