Java Arrays fill方法-填充short类型


Java Arrays fill方法-填充short类型

package com.codingdict;

import java.util.Arrays;

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

      // initializing short array
      short arr[] = new short[] {1, 5, 3, 2, 13};

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

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

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