@Test public void testSetBit() throws Exception { assertEquals(81, ArraysUtil.setBit((byte) 80, 1, true)); assertEquals(119, ArraysUtil.setBit((byte) 127, 4, false)); }
public static byte setBit(byte _byte, int position, boolean value) { position--; return (byte) (value ? _byte | 1 << position : _byte & ~(1 << position)); }
ArraysUtil { public static byte setBit(byte _byte, int position, boolean value) { position--; return (byte) (value ? _byte | 1 << position : _byte & ~(1 << position)); } }
ArraysUtil { public static byte setBit(byte _byte, int position, boolean value) { position--; return (byte) (value ? _byte | 1 << position : _byte & ~(1 << position)); } private  ArraysUtil(); }
ArraysUtil { public static byte setBit(byte _byte, int position, boolean value) { position--; return (byte) (value ? _byte | 1 << position : _byte & ~(1 << position)); } private  ArraysUtil(); static BitSet getBitAddress(String ip); static int bytes2int(byte[] bytes); static byte[] combine(byte[]... bytes); static byte convertBits(Boolean... bits); static byte[] copy(byte[] source); static int getBit(byte _byte, int position); static byte[] int2bytes(int value); static byte[] int2bytesCropp(int value, int nbytes2cropp); static byte[] readBytes(byte[] source, int start); static byte[] readBytes(byte[] source, int start, int length); static byte reverseBitsByte(byte x); static byte setBit(byte _byte, int position, boolean value); }
ArraysUtil { public static byte setBit(byte _byte, int position, boolean value) { position--; return (byte) (value ? _byte | 1 << position : _byte & ~(1 << position)); } private  ArraysUtil(); static BitSet getBitAddress(String ip); static int bytes2int(byte[] bytes); static byte[] combine(byte[]... bytes); static byte convertBits(Boolean... bits); static byte[] copy(byte[] source); static int getBit(byte _byte, int position); static byte[] int2bytes(int value); static byte[] int2bytesCropp(int value, int nbytes2cropp); static byte[] readBytes(byte[] source, int start); static byte[] readBytes(byte[] source, int start, int length); static byte reverseBitsByte(byte x); static byte setBit(byte _byte, int position, boolean value);  }