Java Arrays copyOf 方法拷贝boolean类型 Java Arrays 二分查找 Super Java Arrays copyOf 方法拷贝byte类型 Java Arrays copyOf 方法拷贝boolean类型 package com.codingdict; import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { // intializing an array arr1 boolean[] arr1 = new boolean[] {true, false}; // printing the array System.out.println("Printing 1st array:"); for (int i = 0; i < arr1.length; i++) { System.out.println(arr1[i]); } // copying array arr1 to arr2 with newlength as 4 boolean[] arr2 = Arrays.copyOf(arr1, 4); arr2[2] = false; arr2[3] = true; // printing the array arr2 System.out.println("Printing new array:"); for (int i = 0; i < arr2.length; i++) { System.out.println(arr2[i]); } } } Java Arrays 二分查找 Super Java Arrays copyOf 方法拷贝byte类型