Java Arrays填充-使用索引填充short Java示例数字的总和1 Java示例数字的总和2 Java Arrays填充-使用索引填充short package com.codingdict; import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { // initializing short array short arr[] = new short[] {2, 5, 13, 29, 97}; // let us print the values System.out.println("Actual values: "); for (short value : arr) { System.out.println("Value = " + value); } // using fill for placing 19 from index 1 to 3 Arrays.fill(arr, (short)1, (short)3, (short)19); // let us print the values System.out.println("New values after using fill() method: "); for (short value : arr) { System.out.println("Value = " + value); } } } Java示例数字的总和1 Java示例数字的总和2