Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * for the reason, we use some bit to differ whether it is softap or sta. so, we may get the polluted bssid.
     * 
     * softap bssid: 1a:fe:34:77:c0:00 sta bssid: 18:fe:34:77:c0:00
     * 
     * @param BSSID
     * @return the real BSSID(SoftAp's BSSID)
     */
    public static String restoreSoftApBSSID(String BSSID) {
        String pollutedBitStr = BSSID.substring(1, 2);
        Integer pollutedBitInt = 0;
        // get pollutedBitInt according to 0x..
        pollutedBitInt = Integer.parseInt(pollutedBitStr, 16);
        Integer cleanBitInt = pollutedBitInt | 0x02;
        String cleanBitStr = Integer.toHexString(cleanBitInt);
        return BSSID.substring(0, 1) + cleanBitStr + BSSID.substring(2);
    }
}