public abstract class RangeUtil extends Object
| Modifier | Constructor and Description |
|---|---|
protected |
RangeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static double |
clip(double value,
double min,
double max) |
static double |
clip(int value,
int min,
int max) |
static double |
clip(long value,
long min,
long max) |
static long |
sumOfRange(long end)
Calculate the sum of all values from 1 to
end, including. |
static long |
sumOfRange(long start,
long end)
Calculates the sum of all values from
start to
end, including. |
public static long sumOfRange(long end)
end, including.
That is: sum = 1 + 2 + 3 + ... + (end-1) + end
f(0) = 0
f(1) = 1
f(2) = 3
f(3) = 6
f(10) = 55
f(100) = 5050
end - The end value of the sum-range.end, including.public static long sumOfRange(long start,
long end)
start to
end, including.start - The start value of the sum-range.end - The end value of the sum-range.start to end
, including.public static double clip(int value,
int min,
int max)
public static double clip(long value,
long min,
long max)
public static double clip(double value,
double min,
double max)
Copyright © 2012. All Rights Reserved.