Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********************
- Nikita Dua
- Comp Sci A p3
- Array Lab
- *********************/
- import java.util.ArrayList;
- import java.util.Scanner;
- public class ArrayListRunner
- {
- public static void main(String[] args)
- {
- //create test arrays
- ArrayList<Integer> data = new ArrayList<Integer>();
- data.add(4);
- data.add(7);
- data.add(0);
- data.add(1);
- data.add(9);
- //create 2nd test array
- ArrayList<Integer> data2 = new ArrayList<Integer>();
- data2.add(20);
- data2.add(3);
- data2.add(-7);
- //create 3rd test array
- ArrayList<Integer> data3 = new ArrayList<Integer>();
- //testing static scaleByK method
- ArrayListLab.scaleByK(data);//test 0
- ArrayListLab.scaleByK(data2);//test negative numbers
- ArrayListLab.scaleByK(data3);//test blank array
- //testing static interleave method
- ArrayListLab.interleave(data,data2);//test with a1 of bigger size
- ArrayListLab.interleave(data2,data);//test with a2 of bigger size
- ArrayListLab.interleave(data,data3);//test with blank array
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement