Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. /********************
  2. Nikita Dua
  3. Comp Sci A p3
  4. Array Lab
  5. *********************/
  6.  
  7. import java.util.ArrayList;
  8. import java.util.Scanner;
  9.  
  10. public class ArrayListRunner
  11. {
  12. public static void main(String[] args)
  13. {
  14. //create test arrays
  15. ArrayList<Integer> data = new ArrayList<Integer>();
  16. data.add(4);
  17. data.add(7);
  18. data.add(0);
  19. data.add(1);
  20. data.add(9);
  21.  
  22. //create 2nd test array
  23. ArrayList<Integer> data2 = new ArrayList<Integer>();
  24. data2.add(20);
  25. data2.add(3);
  26. data2.add(-7);
  27.  
  28. //create 3rd test array
  29. ArrayList<Integer> data3 = new ArrayList<Integer>();
  30.  
  31. //testing static scaleByK method
  32. ArrayListLab.scaleByK(data);//test 0
  33. ArrayListLab.scaleByK(data2);//test negative numbers
  34. ArrayListLab.scaleByK(data3);//test blank array
  35.  
  36. //testing static interleave method
  37. ArrayListLab.interleave(data,data2);//test with a1 of bigger size
  38. ArrayListLab.interleave(data2,data);//test with a2 of bigger size
  39. ArrayListLab.interleave(data,data3);//test with blank array
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement