Question1: Integer.MAX_VALUE - Integer.MIN_VALUE == -1 Question2: public class Question2 { public static boolean isHarmonic(double[] a) { for (int i = 1; i < a.length-1; i++) { if (!(a[i] == (a[i-1] + a[i+1])/2)) return false; } return true; } public static void main(String[] args) { double[] a = new double[args.length]; for (int i = 0; i < a.length; i++) { a[i] = Double.parseDouble(args[i]); } System.out.println(isHarmonic(a)); } } Question3: public class Team { List people; public Team() { people = new ArrayList(); } public void addPerson(Person person) { people.add(person); } public Person getLeader() { Person leader = null; for (int i = 0; i < people.size(); i++) { Person p = (Person) people.get(i); if (leader == null || leader.getAge() < p.getAge()) leader = p; } return leader; } public Person getVolunteer() { int index = Math.random() * people.size(); return (Person) people.get(index); } void print(PrintStream out) { Person leader = getLeader(); for (int i = 0; i < people.size(); i++) { Person p = (Person) people.get(i); if (p == leader) out.println(p.getName()+" "+"*"); else out.println(p.getName()); } } } Question 4: public class Primes { private boolean[] primes; public Primes(int n) { primes = new boolean[n]; for (int i = 2; i < n; i++) { if (!primes[i]) { for (int j = 2*i; j < n; j+=i) { primes[j] = true; } } } } public boolean isPrime(int i) { return !primes[i]; } } Question 5: public HashMap wordCounts(Scanner in) { HashMap map = new HashMap(); while (in.hasNext()) { String word = in.next(); Object o = map.get(word); if (o == null) map.put(word,1); else map.put(word,((int) o)+1); } return map; }