Java Byte Array Convert To bytesToStringMac(byte[] mac)

Here you can find the source of bytesToStringMac(byte[] mac)

Description

bytes To String Mac

License

Open Source License

Declaration

private static String bytesToStringMac(byte[] mac) 

Method Source Code

//package com.java2s;
/**/*from w  w  w.j a v a  2 s.  c  o  m*/
 * Copyright 2013-2015 Seagate Technology LLC.
 *
 * This Source Code Form is subject to the terms of the Mozilla
 * Public License, v. 2.0. If a copy of the MPL was not
 * distributed with this file, You can obtain one at
 * https://mozilla.org/MP:/2.0/.
 * 
 * This program is distributed in the hope that it will be useful,
 * but is provided AS-IS, WITHOUT ANY WARRANTY; including without 
 * the implied warranty of MERCHANTABILITY, NON-INFRINGEMENT or 
 * FITNESS FOR A PARTICULAR PURPOSE. See the Mozilla Public 
 * License for more details.
 *
 * See www.openkinetic.org for more project information
 */

public class Main {
    private static String bytesToStringMac(byte[] mac) {
        StringBuilder sb = new StringBuilder(18);
        for (byte b : mac) {
            if (sb.length() > 0) {
                sb.append(':');
            }
            sb.append(String.format("%02x", b));
        }

        return sb.toString();
    }
}

Related

  1. bytesToPdu(byte[] bytes)
  2. bytesToSectors(long bytes)
  3. bytesToSignedInt(byte bb1, byte bb2)
  4. bytesToStore(int bits)
  5. bytesToStringAscii(byte[] bytes)
  6. bytesToStringUTFCustom(byte[] bytes)
  7. bytesToSVar64(final byte[] buffer, final int offset)
  8. bytesToTagBE(byte[] bytes, int off)
  9. bytesToText(byte[] bytes)