Java tutorial
//package com.java2s; public class Main { private static String convertToMac(byte[] mac) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < mac.length; i++) { byte b = mac[i]; int value = 0; if (b >= 0 && b <= 16) { value = b; sb.append("0" + Integer.toHexString(value)); } else if (b > 16) { value = b; sb.append(Integer.toHexString(value)); } else { value = 256 + b; sb.append(Integer.toHexString(value)); } if (i != mac.length - 1) { sb.append(":"); } } return sb.toString(); } }