Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Locale;

public class Main {
    /**
     * restore the bssid from esptouch result
     * 
     * @param BSSID like 18fe34abcdef or 18FE34ABCDEF
     * @return like 18:fe:34:ab:cd:ef
     */
    public static String restoreBSSID(String BSSID) {
        StringBuilder sb = new StringBuilder();
        for (int index = 0; index < BSSID.length(); index += 2) {
            sb.append(BSSID.substring(index, index + 2));
            if (index != BSSID.length() - 2) {
                sb.append(":");
            }
        }
        return sb.toString().toLowerCase(Locale.US);
    }
}