Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    private static int MAC_ADDR_LEN = 6;

    public static String getDeviceBssid(byte[] responseBytes) {
        int deviceBssidOffset = 0x0a;
        int deviceBssidCount = MAC_ADDR_LEN;
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < deviceBssidCount; ++i) {
            if (i != 0) {
                sb.append(":");
            }
            int hexValue = 0xff & responseBytes[deviceBssidOffset + i];
            if (hexValue < 0x0f) {
                sb.append("0");
            }
            sb.append(Integer.toHexString(hexValue));
        }
        return sb.toString();
    }
}