@Test public void testGetValue() { System.out.println("Test getValue()"); assertArrayEquals(toBytes(0, false, 0), b()); assertArrayEquals(toBytes(0, false, 1), b(0x10)); assertArrayEquals(toBytes(0, false, 15), b(0xf0)); assertArrayEquals(toBytes(0, false, 16), b(0x01, 0x00)); assertArrayEquals(toBytes(0, false, 79), b(0x04, 0xf0)); assertArrayEquals(toBytes(0, false, 113), b(0x07, 0x10)); assertArrayEquals(toBytes(0, false, 26387), b(0x06, 0x71, 0x30)); assertArrayEquals(toBytes(0, false, 1048575), b(0xff, 0xff, 0xf0)); assertArrayEquals(toBytes(7, false, 1048575), b(0xff, 0xff, 0xf7)); assertArrayEquals(toBytes(7, true, 1048575), b(0xff, 0xff, 0xff)); }
public byte[] getValue() { int last = szx | (m ? 1<<3 : 0); if (num == 0 && !m && szx==0) { return Bytes.EMPTY; } else if (num < 1 << 4) { return new byte[] {(byte) (last | (num << 4))}; } else if (num < 1 << 12) { return new byte[] { (byte) (num >> 4), (byte) (last | (num << 4)), }; } else { return new byte[] { (byte) (num >> 12), (byte) (num >> 4), (byte) (last | (num << 4)), }; } }
BlockOption { public byte[] getValue() { int last = szx | (m ? 1<<3 : 0); if (num == 0 && !m && szx==0) { return Bytes.EMPTY; } else if (num < 1 << 4) { return new byte[] {(byte) (last | (num << 4))}; } else if (num < 1 << 12) { return new byte[] { (byte) (num >> 4), (byte) (last | (num << 4)), }; } else { return new byte[] { (byte) (num >> 12), (byte) (num >> 4), (byte) (last | (num << 4)), }; } } }
BlockOption { public byte[] getValue() { int last = szx | (m ? 1<<3 : 0); if (num == 0 && !m && szx==0) { return Bytes.EMPTY; } else if (num < 1 << 4) { return new byte[] {(byte) (last | (num << 4))}; } else if (num < 1 << 12) { return new byte[] { (byte) (num >> 4), (byte) (last | (num << 4)), }; } else { return new byte[] { (byte) (num >> 12), (byte) (num >> 4), (byte) (last | (num << 4)), }; } } BlockOption(final int szx, final boolean m, final int num);  BlockOption(final BlockOption origin);  BlockOption(final byte[] value); }
BlockOption { public byte[] getValue() { int last = szx | (m ? 1<<3 : 0); if (num == 0 && !m && szx==0) { return Bytes.EMPTY; } else if (num < 1 << 4) { return new byte[] {(byte) (last | (num << 4))}; } else if (num < 1 << 12) { return new byte[] { (byte) (num >> 4), (byte) (last | (num << 4)), }; } else { return new byte[] { (byte) (num >> 12), (byte) (num >> 4), (byte) (last | (num << 4)), }; } } BlockOption(final int szx, final boolean m, final int num);  BlockOption(final BlockOption origin);  BlockOption(final byte[] value); int getSzx(); int getSize(); boolean isM(); int getNum(); byte[] getValue(); int getOffset(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); static int size2Szx(int blockSize); static int szx2Size(final int szx); }
BlockOption { public byte[] getValue() { int last = szx | (m ? 1<<3 : 0); if (num == 0 && !m && szx==0) { return Bytes.EMPTY; } else if (num < 1 << 4) { return new byte[] {(byte) (last | (num << 4))}; } else if (num < 1 << 12) { return new byte[] { (byte) (num >> 4), (byte) (last | (num << 4)), }; } else { return new byte[] { (byte) (num >> 12), (byte) (num >> 4), (byte) (last | (num << 4)), }; } } BlockOption(final int szx, final boolean m, final int num);  BlockOption(final BlockOption origin);  BlockOption(final byte[] value); int getSzx(); int getSize(); boolean isM(); int getNum(); byte[] getValue(); int getOffset(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); static int size2Szx(int blockSize); static int szx2Size(final int szx);  }