class CompactEncoder {

	public static byte[] unpackToNibbles(byte[] str) {
		byte[] base = binToNibbles(str);
		base = copyOf(base, base.length - 1);
		if (base[0] >= 2) {
			base = appendByte(base, TERMINATOR);
		}
		if (base[0] % 2 == 1) {
			base = copyOfRange(base, 1, base.length);
		} else {
			base = copyOfRange(base, 2, base.length);
		}
		return base;
	}

}