-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathPredicateUtilities.java
More file actions
57 lines (52 loc) · 1.49 KB
/
PredicateUtilities.java
File metadata and controls
57 lines (52 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.dtcc.exams.fundamentals;
public class PredicateUtilities {
/**
* @param value - the value to be evaluated
* @return true if `value` is a multiple of 2
*/
public static Boolean isEven(Integer value) {
if (value % 2 == 0)
return true;
else
return false;
}
/**
* @param value - the value to be evaluated
* @return true if `value` is not a multiple of 2
*/
public static Boolean isOdd(Integer value) {
if(value % 2 != 0)
return true;
else return false;
}
/**
* @param value - the value to be evaluated
* @return true if `value` is a multiple of 3
*/
public static Boolean isMultipleOf3(Integer value) {
if(value % 3 == 0)
return true;
else return false;
}
/**
*
* @param value - the value to be evaluated
* @param multiple - the multiple to test `value` against
* @return true if `value` is a multiple of `multiple`
*/
public static Boolean isMultipleOfN(Integer value, Integer multiple) {
if(value % multiple == 0)
return true;
else return false;
}
/**
* @param string - the string to be evaluated
* @return true if `string` starts with a capital letter
*/
public static Boolean startsWithCapitalLetter(String string) {
if(Character.isUpperCase(string.charAt(0)) == true)
return true;
else
return false;
}
}