import java.math.BigInteger; import java.util.Arrays; import java.util.ArrayList; import java.util.HashMap; public class LP1 { //test your methods in heare. public static void main(String[] args) { BigInteger test = BigInteger.TWO.pow(100); System.out.println(isAPowerOf2(test)); test = BigInteger.valueOf(23234123); System.out.println(isAPowerOf2(test)); } //easy. /** * Computes the sum of an integer array * @param arr an array of integers * @return the sum of the entries in arr */ public static int arraySum(int [] arr) { int out = 0; return out; } //easy. get two and it's a B- /** * This function pulls all vowels, in * from a string * and returns them bundled in a string * @param s the string you are extracting from * @return a string containing all vowels (aeiou) * from s in their original case. */ public static String vowelExtractor(String s) { return ""; } //medium. Get 3 it's a B. /** * This functon tests if the BigInteger passed it is a power of 2. * @param b is a BigInteger * @return true if b is a power of 2 and false otherwise. */ public static boolean isAPowerOf2(BigInteger b) { return false; } //medium. Get 4 and it's an A-/B+ /** * This function returns a new array list with * all elements from the array list <code>a</code> begin with all * letters between characters <code>low</code> * and <code>high</code>, inclusive and case-insensitive. * @param a an array list of nonempty strings * @param low a letter character * @param high a letter character * @return a new array list containing all entries of a * whose first letter is between low and high, inclusive. * If low &gt; high, switch them. NOTE: * characters are primitives, use &lt;, &gt;, &lt;= , &gt;=, * !=, and == to * compare them! */ public static ArrayList<String> between(ArrayList<String> a, char low, char high) { ArrayList<String> out = new ArrayList<>(); return out; } //some challenge: get 5 for a middle A. /** * @param n is a nonnegative integer * @param base is a base ( between 2 and 36 inclusive) * @return the total of the digits in a base b expansion of n */ public static int sumOfDigits(int n, int base) { int out = 0; return out; } //some challenge: Get 6 and it's 100. /** * 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. * @param s a string * @return 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. */ public static HashMap<Character, Integer> alphaCharCount(String s) { return new HashMap<Character, Integer>(); } }