62,633
社区成员
发帖
与我相关
我的任务
分享
import java.util.*;
public class ListToDoubleArray{
public static void main(String args[]){
List<Double> list=new ArrayList<Double>();
list.add(1.0);list.add(2.0);list.add(3.0);
Double[] d=new Double[list.size()];
list.toArray(d);
System.out.println(Arrays.toString(d));
}
}
/**
* @param args
*/
public static void main(String[] args)
{
List list = new ArrayList();
list.add(new Double(2.222));
list.add(new Double(2.53363));
int length = list.size();
double[] d = new double[length];
for (int i = 0; i < length; i++)
{
d[i] = (Double) list.get(i);
}
for (int i = 0; i < length; i++)
{
System.out.println(d[i]);
}
}