Exemple #1
0
 public static byte[] decodeMacAddress(final String mac) {
   final StringTokenizer tokens = new StringTokenizer(mac, "-");
   if (tokens.countTokens() != MAC_ADDRESS_TOKENS) {
     throw new IllegalArgumentException("Unexpected mac address representation: " + mac);
   }
   final StringBuilder buf = new StringBuilder(MAC_ADDRESS_TOKENS * 2);
   for (int i = 0; i < MAC_ADDRESS_TOKENS; i++) {
     buf.append(tokens.nextToken());
   }
   char[] c = buf.toString().toCharArray();
   return StringUtils.decodeHex(c);
 }