I have a problem in converting from Array to ArrayList
public class one
{
public static void main(String args[])
{
int y[]={12,25,38,46};
two p=new two();
p.setLocations(y);
}
}
import java.io.*;
import java.util.*;
public class two
{
ArrayList<Integer> data_array=new ArrayList<Integer>();
void setLocations(int locations[])
{
ArrayList<Integer> locations_arraylist=new ArrayList(Arrays.asList(locations));
data_array=locations_arraylist;
for(int i=0;i<data_array.size();i++)
System.out.println("data_array["+i+"]="+data_array.get(i));
}
}
In the below line
ArrayList<Integer> locations_arraylist=new ArrayList(Arrays.asList(locations));
//Copying from array to ArrayList-Its converting,Please suggest