Here you can find the source of macToStr(byte[] mac)
static public String macToStr(byte[] mac)
//package com.java2s; /**/* w ww.ja v a 2 s.c o m*/ * NetUtil * Copyright (c) 2014 Frank Duerr * * NetUtil is part of SDN-MQ. 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 { /** * Converts a MAC address to colon hexadecimal representation (e.g., "00:01:02:03:04:05"). */ static public String macToStr(byte[] mac) { StringBuilder strBuilder = new StringBuilder(); for (int i = 0; i < mac.length; i++) { strBuilder.append(String.format("%02X", mac[i])); if (i < mac.length - 1) { strBuilder.append(":"); } } return strBuilder.toString(); } }