Skip to content

Commit e647248

Browse files
committed
remove one method
1 parent 80602cc commit e647248

2 files changed

Lines changed: 0 additions & 21 deletions

File tree

rlib-common/src/main/java/com/ss/rlib/common/util/NumberUtils.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,6 @@ public static byte getLowByteBits(int value) {
253253
return (byte) (value & 0x0F);
254254
}
255255

256-
/**
257-
* Read several bits from a number from some position.
258-
*
259-
* @param value the value.
260-
* @param position the position to start read bits.
261-
* @param count the required count of read bits.
262-
* @return the result value.
263-
*/
264-
public static int readBits(int value, int position, int count) {
265-
return (((1 << count) - 1) & (value >> (position - 1)));
266-
}
267-
268256
/**
269257
* Covert a byte to unsigned byte.
270258
*

rlib-common/src/test/java/com/ss/rlib/common/test/util/NumberUtilsTest.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,4 @@ void shouldChangeBitsInByteCorrectly() {
164164
assertTrue(NumberUtils.isNotSetBit(NumberUtils.unsetBit(255, 6), 6));
165165
assertTrue(NumberUtils.isNotSetBit(NumberUtils.unsetBit(255, 7), 7));
166166
}
167-
168-
@Test
169-
void shouldReadDifferentBitsCorrectly() {
170-
171-
assertEquals(0b0000_1000, NumberUtils.getHighByteBits(0b1000_0100));
172-
System.out.println(Integer.toString(NumberUtils.getHighByteBits(0b1000_0100), 2));
173-
System.out.println(Integer.toString(NumberUtils.readBits(0b1000_0100, 4, 1), 2));
174-
assertEquals(0b0000_1000, NumberUtils.readBits(0b1000_0100, 1, 4));
175-
}
176167
}

0 commit comments

Comments
 (0)