Here you can find the source of macToString(long macAddress)
public static String macToString(long macAddress)
//package com.java2s; //License from project: Apache License public class Main { public static String macToString(long macAddress) { String value = String.format("%012x", macAddress); char[] chars = value.toCharArray(); final StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(chars[0]).append(chars[1]); for (int pos = 2; pos < value.length(); pos += 2) { stringBuilder.append(":").append(chars[pos]).append(chars[pos + 1]); }// www . ja va 2s .c o m return stringBuilder.toString(); } }