Here you can find the source of print(ArrayList
public static void print(ArrayList<Double> l)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static void print(ArrayList<Double> l) { String s = "["; for (int i = 0; i < l.size(); i++) { s += l.get(i);//from w w w. j a v a2s . c o m if (i < l.size() - 1) s += ", "; } s += "]"; System.out.println(s); } public static void print(double[] l) { String s = "["; for (int i = 0; i < l.length; i++) { s += l[i]; if (i < l.length - 1) s += ", "; } s += ", ...]"; System.out.println(s); } public static void print(double[] l, int limit) { String s = "["; for (int i = 0; i < limit; i++) { s += l[i]; if (i < limit - 1) s += ", "; } s += ", ...]"; System.out.println(s); } public static void print(ArrayList<Double> l, int limit) { String s = "["; for (int i = 0; i < limit; i++) { s += l.get(i); if (i < limit - 1) s += ", "; } s += "]"; System.out.println(s); } }