@Test public void testComputeSzxReturnsNextSmallerSize() { assertThat(BlockOption.size2Szx(1600), is(6)); assertThat(BlockOption.size2Szx(1024), is(6)); assertThat(BlockOption.size2Szx(540), is(5)); assertThat(BlockOption.size2Szx(512), is(5)); assertThat(BlockOption.size2Szx(400), is(4)); assertThat(BlockOption.size2Szx(256), is(4)); assertThat(BlockOption.size2Szx(170), is(3)); assertThat(BlockOption.size2Szx(128), is(3)); assertThat(BlockOption.size2Szx(90), is(2)); assertThat(BlockOption.size2Szx(64), is(2)); assertThat(BlockOption.size2Szx(33), is(1)); assertThat(BlockOption.size2Szx(32), is(1)); assertThat(BlockOption.size2Szx(25), is(0)); assertThat(BlockOption.size2Szx(16), is(0)); }
public static int size2Szx(int blockSize) { if (blockSize >= 1024) { return 6; } else if (blockSize <= 16) { return 0; } else { int maxOneBit = Integer.highestOneBit(blockSize); return Integer.numberOfTrailingZeros(maxOneBit) - 4; } }
BlockOption { public static int size2Szx(int blockSize) { if (blockSize >= 1024) { return 6; } else if (blockSize <= 16) { return 0; } else { int maxOneBit = Integer.highestOneBit(blockSize); return Integer.numberOfTrailingZeros(maxOneBit) - 4; } } }
BlockOption { public static int size2Szx(int blockSize) { if (blockSize >= 1024) { return 6; } else if (blockSize <= 16) { return 0; } else { int maxOneBit = Integer.highestOneBit(blockSize); return Integer.numberOfTrailingZeros(maxOneBit) - 4; } } BlockOption(final int szx, final boolean m, final int num);  BlockOption(final BlockOption origin);  BlockOption(final byte[] value); }
BlockOption { public static int size2Szx(int blockSize) { if (blockSize >= 1024) { return 6; } else if (blockSize <= 16) { return 0; } else { int maxOneBit = Integer.highestOneBit(blockSize); return Integer.numberOfTrailingZeros(maxOneBit) - 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 static int size2Szx(int blockSize) { if (blockSize >= 1024) { return 6; } else if (blockSize <= 16) { return 0; } else { int maxOneBit = Integer.highestOneBit(blockSize); return Integer.numberOfTrailingZeros(maxOneBit) - 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);  }