Java Distance Calculate distance(float value1, float value2)

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

Description

distance

License

Apache License

Declaration

public static float distance(float value1, float value2) 

Method Source Code

//package com.java2s;
/**/*from ww w  .  j  a  v a 2  s.  c  o m*/
 * Copyright 2008 - 2011
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 * 
 * @project loonframework
 * @author chenpeng
 * @email?ceponline@yahoo.com.cn
 * @version 0.1
 */

public class Main {
    public static float distance(float value1, float value2) {
        return Math.abs(value1 - value2);
    }

    static public final float abs(float n) {
        return (n < 0) ? -n : n;
    }

    static public final int abs(int n) {
        return (n < 0) ? -n : n;
    }
}

Related

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