Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**Calculates the estimated distance between the access point based on frequency and signal strength in db. 
     * Based on the Free-space path loss equation at http://en.wikipedia.org/wiki/FSPL
     * 
     * @param levelInDb
     * @param freqInMHz
     * @return
     */
    public static double calculateDistance(double levelInDb, double freqInMHz) {
        double exp = (27.55 - (20 * Math.log10(freqInMHz)) + Math.abs(levelInDb)) / 20.0;
        return Math.pow(10.0, exp);
    }
}