Java Distance Calculate distance(float value1, float value2)

Here you can find the source of distance(float value1, float value2)

Description

Get the distance between two values.

License

Open Source License

Parameter

Parameter Description
value1 a parameter
value2 a parameter

Return

Return the distance between value1 and value2

Declaration

public static float distance(float value1, float value2) 

Method Source Code

//package com.java2s;
// file 'LICENSE', which is part of this source code package.

public class Main {
    /**// w  ww . j  av  a2  s  . co  m
     * Get the distance between two values.
     * @param value1
     * @param value2
     * @return Return the distance between value1 and value2
     */
    public static float distance(float value1, float value2) {
        return Math.abs(value1 - value2);
    }

    /**
     * Get the distance between two values.
     * @param value1
     * @param value2
     * @return Return the distance between value1 and value2
     */
    public static int distance(int value1, int value2) {
        return (int) distance((float) value1, (float) value2);
    }
}

Related

  1. distance(final String c1, final String c2, final String c1Prev, final String c2Prev)
  2. distance(float aX, float aY, float bX, float bY)
  3. distance(float speed, float delta)
  4. distance(float value1, float value2)
  5. distance(float value1, float value2)
  6. distance(float x1, float x2, float y1, float y2)
  7. distance(float x1, float y1, float x2, float y2)
  8. distance(float x1, float y1, float x2, float y2)
  9. distance(float x1, float y1, float x2, float y2)