提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从int和int数组生成一个整数数组列表。
//package com.nowjava;/**来 自 nowjava**/ import java.util.ArrayList; public class Main { public static void main(String[] argv) throws Exception { int[] list = new int[] { 34, 35, 36, 37, 37, 37, 67, 68, 69 }; System.out.println(buildArray(list)); } /** * Build an ArrayList of Integer from and array of int. */ public static ArrayList buildArray(int[] list) { ArrayList nlist = new ArrayList(list.length); for (int i = 0; i < list.length; i++) { Integer val =