示例#1
0
 public static byte[] getIpBytes(OctetString mac) {
   if (mac.getLength() != 18) throw new IllegalArgumentException("Not an I/Pv6 mac");
   byte[] b = new byte[16];
   System.arraycopy(mac.getBytes(), 0, b, 0, 16);
   return b;
 }
示例#2
0
 public static int getPort(OctetString mac) {
   if (mac.getLength() != 18) throw new IllegalArgumentException("Not an I/Pv6 mac");
   return ((mac.getBytes()[16] & 0xff) << 8) | (mac.getBytes()[17] & 0xff);
 }