Java Mac Address to String macToString(String srcstr)

Here you can find the source of macToString(String srcstr)

Description

mac To String

License

Open Source License

Declaration

public static String macToString(String srcstr) 

Method Source Code

//package com.java2s;
/*//from w w  w.j av a 2  s .  c  o m
 * Copyright (c) 2015 Dell Inc. and others.  All rights reserved.
 *
 * 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 {
    public static String macToString(String srcstr) {

        if (srcstr == null) {
            return "null";
        }

        StringBuffer buf = new StringBuffer();
        for (int i = 0; i < srcstr.length(); i = i + 3) {
            buf.append(srcstr.charAt(i));
            buf.append(srcstr.charAt(i + 1));
        }
        return buf.toString();
    }
}

Related

  1. macToStr(byte[] mac)
  2. macToString(byte[] mac)
  3. macToString(byte[] mac)
  4. macToString(final byte[] address)
  5. macToString(long macAddress)