Just1n2802

csc test hint code

Sep 21st, 2021 (edited)
110
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.ArrayList;
  2. import java.util.Arrays;
  3.  
  4.  
  5. public class hint {
  6.     public static void main(String[] args) {
  7.         //List of Integer arrays
  8.         ArrayList<Integer[]> list = new ArrayList<Integer[]>();
  9.         Integer[] arr1 = {1,2,3};
  10.         Integer[] arr2 = {4,5,6,7,8};
  11.         list.add(arr1);
  12.         list.add(arr2);
  13.         //printing list of Integers arrays in the ArrayList
  14.         for(Integer[] strArr: list) {
  15.             System.out.println(Arrays.toString(strArr));
  16.         }
  17.         Integer totalsize = list.get(0).length; //len of first array in ArrayList
  18.         Integer[] temp = new Integer[totalsize];
  19.         int i = 0;
  20.         for(Integer element: list.get(0)) //copy out array for later sorting
  21.         {
  22.             temp[i] = element;
  23.             i++;
  24.         }
  25.         for(i=0; i<temp.length; i++)
  26.         {
  27.             System.out.println(temp);
  28.         }
  29.     }
  30. }
  31.  
RAW Paste Data