Java Arrays fill方法-填充long


Java Arrays fill方法-填充long

package com.codingdict;

import java.util.Arrays;

public class ArrayDemo {
   public static void main(String[] args) {

      // initializing long array
      long arr[] = new long[] {1, 16, 34, 149, 17};

      // let us print the values
      System.out.println("Actual values: ");
      for (long value : arr) {
         System.out.println("Value = " + value);
      }

      // using fill for placing 12
      Arrays.fill(arr, 12);

      // let us print the values
      System.out.println("New values after using fill() method: ");
      for (long value : arr) {
         System.out.println("Value = " + value);
      }
   }
}