Question: 1. Write a method: public static int columnSum(int[][] a, int x) that returns the sum of the elements in Column x of a (careful with
1. Write a method:
public static int columnSum(int[][] a, int x) that returns the sum of the elements in Column x of a (careful with rows of different lengths!).
2. Write a method:
public static int[] allRowSums(int[][] a) that calculates the row sum for every row and returns each of the values in an array.
3. Write a method change2 that changes the order of values in an ArrayList of Strings in a pairwise fashion. Your method will change the order of the first two values, then change the order of the next two values, etc. You can assume the arrayList will always have data and its size will always be even.
Example: if the ArrayList had the following values {"120", "130", "210", "330", "490", "491"} then after running your method, the ArrayList values will be {"130", "120", "330", "210", "491", "490"} public void change2 (ArrayList
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
