How to find beacon distance by the received RSSI? in Android

Please tell me how to find the distance buy the received rssi of a respective beacon

  public double getDistance(int measuredPower, double rssi) {
    		if (rssi >= 0) {
    			return -1.0;
    		}
    		if (measuredPower == 0) {
    			return -1.0;
    		}
    		double ratio = rssi * 1.0 / measuredPower;
    		if (ratio < 1.0) {
    			return Math.pow(ratio, 10);
    		} else {
    			double distance= (0.42093) * Math.pow(ratio, 6.9476) + 0.54992;
    			return distance;
    		}
       }

hi hell
I am calling getdistance method in monitoring and ranging also.but why it is not calling everytime.please reply me as fast as possible…

Thanking you…

the above distance formula returns in distance in what parameters like centimeters or meters etc…