MAC Address String To Byte Array - Android File Input Output

Android examples for File Input Output:Byte Array Convert

Description

MAC Address String To Byte Array

Demo Code


//package com.book2s;

public class Main {
    public static byte[] MACStringToByteArray(String address) {
        String[] addrs = address.split(":");
        byte[] mac_bytes = new byte[6];
        for (int i = 0; i < addrs.length; i++) {
            mac_bytes[i] = Integer.decode("0x" + addrs[i]).byteValue();
        }//from  w w  w . j a va2s  .c  o  m
        return mac_bytes;
    }
}

Related Tutorials