int[]数组指定位置添加元素

package cn.collection.com;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

public class ListDemo4 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub

        int[] arr = { 11, 22, 33, 44, 55 };

        // 遍历
        for (int x = 0; x < arr.length; x++) {
            int ss = arr[x];
            if (ss == 22) {//当遍历的数组值有等于22的时候
                arr[x + 1] = 88;//在当前数组位置后面添加一个88元素
            }
            System.out.println(ss);// 打印

        }

    }

}
原文地址:https://www.cnblogs.com/yschung/p/9305935.html