Class LP1
java.lang.Object
LP1
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThis produces a hash map containing as keys the letters a-z and values that show the number of times each character appears in the string, case insensitive.static intarraySum(int[] arr) Computes the sum of an integer arrayThis function returns a new array list with all elements from the array listabegin with all letters between characterslowandhigh, inclusive and case-insensitive.static booleanThis functon tests if the BigInteger passed it is a power of 2.static voidstatic intsumOfDigits(int n, int base) static StringThis function pulls all vowels, in from a string and returns them bundled in a string
-
Constructor Details
-
LP1
public LP1()
-
-
Method Details
-
main
-
arraySum
public static int arraySum(int[] arr) Computes the sum of an integer array- Parameters:
arr- an array of integers- Returns:
- the sum of the entries in arr
-
vowelExtractor
This function pulls all vowels, in from a string and returns them bundled in a string- Parameters:
s- the string you are extracting from- Returns:
- a string containing all vowels (aeiou) from s in their original case.
-
isAPowerOf2
This functon tests if the BigInteger passed it is a power of 2.- Parameters:
b- is a BigInteger- Returns:
- true if b is a power of 2 and false otherwise.
-
between
This function returns a new array list with all elements from the array listabegin with all letters between characterslowandhigh, inclusive and case-insensitive.- Parameters:
a- an array list of nonempty stringslow- a letter characterhigh- a letter character- Returns:
- a new array list containing all entries of a whose first letter is between low and high, inclusive. If low > high, switch them. NOTE: characters are primitives, use <, >, <= , >=, !=, and == to * compare them!
-
sumOfDigits
public static int sumOfDigits(int n, int base) - Parameters:
n- is a nonnegative integerbase- is a base ( between 2 and 36 inclusive)- Returns:
- the total of the digits in a base b expansion of n
-
alphaCharCount
This produces a hash map containing as keys the letters a-z and values that show the number of times each character appears in the string, case insensitive.- Parameters:
s- a string- Returns:
- a "dictionary" in a HashMap containing as keys the letters a-z and as values the number of times each character occurs in the string, case insensitive.
-