@Test public void testGetBitAddress() throws Exception { assertArrayEquals(new byte[] {-2, 0, 0, -128}, ArraysUtil.getBitAddress("127.0.0.1").toByteArray()); assertArrayEquals(new byte[] {-1, -1, -1, 127}, ArraysUtil.getBitAddress("255.255.255.254").toByteArray()); }
public static BitSet getBitAddress(String ip) { byte[] address = InetAddresses.forString(ip).getAddress(); for (int i = 0; i < address.length; i++) { address[i] = ArraysUtil.reverseBitsByte(address[i]); } return BitSet.valueOf(address); }
ArraysUtil { public static BitSet getBitAddress(String ip) { byte[] address = InetAddresses.forString(ip).getAddress(); for (int i = 0; i < address.length; i++) { address[i] = ArraysUtil.reverseBitsByte(address[i]); } return BitSet.valueOf(address); } }
ArraysUtil { public static BitSet getBitAddress(String ip) { byte[] address = InetAddresses.forString(ip).getAddress(); for (int i = 0; i < address.length; i++) { address[i] = ArraysUtil.reverseBitsByte(address[i]); } return BitSet.valueOf(address); } private  ArraysUtil(); }
ArraysUtil { public static BitSet getBitAddress(String ip) { byte[] address = InetAddresses.forString(ip).getAddress(); for (int i = 0; i < address.length; i++) { address[i] = ArraysUtil.reverseBitsByte(address[i]); } return BitSet.valueOf(address); } 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 BitSet getBitAddress(String ip) { byte[] address = InetAddresses.forString(ip).getAddress(); for (int i = 0; i < address.length; i++) { address[i] = ArraysUtil.reverseBitsByte(address[i]); } return BitSet.valueOf(address); } 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);  }