Java tutorial
//package com.java2s; public class Main { public static String toMacFormat(String mac) { if (mac.length() == 12) { StringBuffer sb = new StringBuffer(mac); sb.insert(10, ':'); sb.insert(8, ':'); sb.insert(6, ':'); sb.insert(4, ':'); sb.insert(2, ':'); return sb.toString(); } return ""; } }