Class LP1


public class LP1 extends Object
  • Constructor Details

    • LP1

      public LP1()
  • Method Details

    • main

      public static void main(String[] args)
    • 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

      public static String vowelExtractor(String s)
      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

      public static boolean isAPowerOf2(BigInteger b)
      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

      public static ArrayList<String> between(ArrayList<String> a, char low, char high)
      This function returns a new array list with all elements from the array list a begin with all letters between characters low and high, inclusive and case-insensitive.
      Parameters:
      a - an array list of nonempty strings
      low - a letter character
      high - 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 integer
      base - is a base ( between 2 and 36 inclusive)
      Returns:
      the total of the digits in a base b expansion of n
    • alphaCharCount

      public static HashMap<Character,Integer> alphaCharCount(String s)
      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.