Java Zero Format zeroToOne(float value, float min, float max)

Here you can find the source of zeroToOne(float value, float min, float max)

Description

zero To One

License

Open Source License

Declaration

public static float zeroToOne(float value, float min, float max) 

Method Source Code

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

public class Main {
    public static float zeroToOne(float value, float min, float max) {
        return clamp(0.0f, (value - min) / (max - min), 1.0f);
    }/*from   w  w  w .  j  av a  2  s  . c  o  m*/

    public static double zeroToOne(double value, double min, double max) {
        return clamp(0.0, (value - min) / (max - min), 1.0);
    }

    public static float clamp(float min, float value, float max) {
        return value < min ? min : value > max ? max : value;
    }

    public static double clamp(double min, double value, double max) {
        return value < min ? min : value > max ? max : value;
    }
}

Related

  1. zerosInt(int len)
  2. zeroString(int length)
  3. zeroString(int value)
  4. zeroSupply(String value, int len)
  5. zeroThrough(int max)
  6. zeroToOne(long _min, long _max, long _value)
  7. zeroToSpace(String s)
  8. zeroToStr(String fStr, String lStr)
  9. zeroUnPad(String s)