Java Distance Calculate distExtraBits(int dist)

Here you can find the source of distExtraBits(int dist)

Description

dist Extra Bits

License

Open Source License

Declaration

private static int distExtraBits(int dist) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static int distExtraBits(int dist) {
        if (dist < 5) {
            return 0;
        } else if (dist < 9) {
            return 1;
        } else if (dist < 17) {
            return 2;
        } else if (dist < 33) {
            return 3;
        } else if (dist < 65) {
            return 4;
        } else if (dist < 129) {
            return 5;
        } else if (dist < 257) {
            return 6;
        } else if (dist < 513) {
            return 7;
        } else if (dist < 1025) {
            return 8;
        } else if (dist < 2049) {
            return 9;
        } else if (dist < 4097) {
            return 10;
        } else if (dist < 8193) {
            return 11;
        } else if (dist < 16385) {
            return 12;
        }//ww w . ja v a2s. c  o m
        return 13;
    }
}

Related

  1. distAngle(double[] pos1, double[] pos2)
  2. distBetween(float x1, float y1, float x2, float y2)
  3. distBetweenSq(double x1, double y1, double z1, double x2, double y2, double z2)
  4. distence(double lat1, double lon1, double lat2, double lon2, double radius)
  5. distEucl(float[] x1, float[] x2)
  6. distFrom(double lat1, double lng1, double lat2, double lng2)
  7. distFrom(double lat1, double lng1, double lat2, double lng2)
  8. distHalf(double angA, double angB)
  9. distHaversineRAD(double lat1, double lon1, double lat2, double lon2)