public class Test2F extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
MIN2_LIST_SIZE
The size of the list required by the method Test2F.min2
|
| Modifier and Type | Method and Description |
|---|---|
static int |
countGreaterThan(List<Integer> t,
int value)
Counts the number of elements in
t that are greater than
value. |
static boolean |
isBetween(int min,
int max,
int value)
Returns true if
value is strictly greater than
min and strictly less than max, and false
otherwise. |
static int |
min2(List<Integer> t)
Given a list containing exactly 2 integers, returns the smaller of the
two integers.
|
static int |
removeDigits(int aNumber,
int n)
Returns the int value equal to the value obtained by removing
n digits from the the end of aNumber. |
public static final int MIN2_LIST_SIZE
public static boolean isBetween(int min,
int max,
int value)
value is strictly greater than
min and strictly less than max, and false
otherwise.min - a minimum valuemax - a maximum valuevalue - a value to checkvalue is strictly greater than
min and strictly less than max, and
false otherwisepublic static int min2(List<Integer> t)
t is not modified by this method.
For example:
t Test2F.min2(t) --------------------------- [-5, 9] -5 [3, 3] 3 [12, 6] 6
t - a list containing exactly 2 integersIllegalArgumentException - if the list does not contain exactly 2 integerspublic static int countGreaterThan(List<Integer> t, int value)
t that are greater than
value. The list t is not modified by this method.
For example, if value == 3 then:
t Test2F.countGreaterThan(t, 3) ---------------------------------------------------- [] 0 [-5] 0 [3, 4] 1 [12, 6, 8, 2, 2, 2] 3
t - a listvalue - a valuepublic static int removeDigits(int aNumber,
int n)
n digits from the the end of aNumber. The
method will never remove all of the digits of aNumber. If
n is greater than the number of digits in
aNumber then the first digit of aNumber is
returned. For example:
aNumber n Test2F.removeDigits(aNumber, n) ------------------------------------------------ 1 0 1 2 1 2 87 1 8 100353 3 100 -9325256 5 -93 -9325256 999 -9
aNumber - a numbern - the number of digits to remove from the end of aNumber