Here you can find the source of calculateDistance(double rssi, double txPower)
public static Double calculateDistance(double rssi, double txPower)
//package com.java2s; //License from project: Open Source License public class Main { public static Double calculateDistance(double rssi, double txPower) { double ratio; ratio = rssi * 1.0 / txPower;//from ww w. j a va 2 s.c o m if (ratio < 1.0) { return Math.pow(ratio, 10); } else { double distance; distance = (0.89976) * Math.pow(ratio, 7.7095) + 0.111; // distance = Math.pow(10, (-rssi + txPower) / (10 * 2)); // if (distance < Threshold) return distance; // else // return Threshold; } } }