ArrayTest.java package myec_java_test;import java.util.ArrayList;import java.util.Scanner;public class ArrayTest {public static void main(String[] args) {System.out.println("vol ="+Integer.MAX_VALUE);Scanner in=new Scanner(System.in);System
package myec_java_test; import java.util.ArrayList; import java.util.Scanner; public class ArrayTest { public static void main(String[] args) { System.out.println("vol ="+Integer.MAX_VALUE); Scanner in=new Scanner(System.in); System.out.println("input item size"); int cap=in.nextInt(); in.close(); int item[]=new int[cap]; build_item(item); ArrayListtestMain=new ArrayList (); build_testMain(testMain,item); int runCount=1; while(check_testMain(testMain,item)){ System.out.println(runCount+"..."); runCount++; } System.out.println("Error Found"); } static boolean check_testMain(ArrayList test,int item[]) { int vol=test.size(); int vol2=item.length; for(int i=0;i test,int item[]) { long maxMem=Runtime.getRuntime().maxMemory(); System.out.println("max Mem is:"+maxMem); long itemzise=item.length*Integer.BYTES; long testItemCount=maxMem/itemzise; System.out.println("total item in list is:"+testItemCount); testItemCount*=0.7; System.out.println("total item in list is:"+testItemCount); for(long i=0;i