code: @Override
      public double calculateDistance(int txPower, double rssi) {
          if (rssi == 0) {
              return -1.0; // if we cannot determine accuracy, return -1.
          }
  
          LogManager.d(TAG, "calculating distance based on mRssi of %s and txPower of %s", rssi, txPower);
  
  
          double ratio = rssi*1.0/txPower;
          double distance;
          if (ratio < 1.0) {
              distance =  Math.pow(ratio,10);
          }
          else {
              distance =  (mCoefficient1)*Math.pow(ratio,mCoefficient2) + mCoefficient3;
          }
          LogManager.d(TAG, "avg mRssi: %s distance: %s", rssi, distance);
          return distance;
      }
docs: Calculated the estimated distance in meters to the beacon based on a reference rssi at 1m
  and the known actual rssi at the current location
  
  @param txPower
  @param rssi
  @return estimated distance