Java Byte Convert From bytesFrom(String hwAddress)

Here you can find the source of bytesFrom(String hwAddress)

Description

bytes From

License

Open Source License

Declaration

private static byte[] bytesFrom(String hwAddress) 

Method Source Code

//package com.java2s;
/*/*www .ja va  2  s . c  om*/
 * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */

public class Main {
    private static byte[] bytesFrom(String hwAddress) {
        String[] mac = hwAddress.split(":");
        byte[] macAddress = new byte[6]; // mac.length == 6 bytes
        for (int i = 0; i < mac.length; i++) {
            macAddress[i] = Integer.decode("0x" + mac[i]).byteValue();
        }
        return macAddress;
    }
}

Related

  1. asByte(Byte number)
  2. asByte(final Object o)
  3. asByte(Object o)
  4. booleanAsByte(boolean val)
  5. bytesFromDpid(long dpid)
  6. bytesFromHex(String s)
  7. bytesFromHexString(String values)
  8. bytesFromLong(long l)