Java Formatter Usage long2Mac(final long macAddress)

Here you can find the source of long2Mac(final long macAddress)

Description

long Mac

License

Apache License

Declaration

public static String long2Mac(final long macAddress) 

Method Source Code

//package com.java2s;
// Licensed to the Apache Software Foundation (ASF) under one

import java.util.Formatter;

public class Main {
    public static String long2Mac(final long macAddress) {
        final StringBuilder result = new StringBuilder(17);
        try (Formatter formatter = new Formatter(result)) {
            formatter.format("%02x:%02x:%02x:%02x:%02x:%02x",
                    macAddress >> 40 & 0xff, macAddress >> 32 & 0xff,
                    macAddress >> 24 & 0xff, macAddress >> 16 & 0xff,
                    macAddress >> 8 & 0xff, macAddress & 0xff);
        }//from ww  w  .j av  a2s . c  o m
        return result.toString();
    }
}

Related

  1. getPropertiesString(Properties myProps)
  2. GetRawView(String string)
  3. getRoundedString(double value, int powerOf10)
  4. incrementAlpha(String suppliedPrefix, String lastNumber, int numberLength)
  5. listToString(List list, String separator)
  6. millisToHumanTime(long milliseconds)
  7. msToHumanReadableDelta(long start)
  8. numberWithLeadingZeroes(int n, int totalChars)
  9. showVxlanHeaderOutput()