package org.cloudbus.cloudsim.power.models;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * ClassName Test
 * Description
 * Create by HW
 * Date 2021/5/6 17:48
 */
public class Test {
    public static void main(String[] args) {
        String[] strArray = new String[0];
        ArrayList< String> arrayList = new ArrayList<String>(strArray.length);
        Collections.addAll(arrayList, strArray);
        arrayList.add("1");
        arrayList.add("1");
        arrayList.add("1");
        List<String> stringList = arrayList.subList(2, 3);
        System.out.println(stringList);
        System.out.println(arrayList+""+arrayList.size());
        System.out.println(arrayList);
        System.out.println("--------------------");
        //将cpu的利用率转换成列表形式，剔除第一个数据
        Double[] primitiveUtilization = new Double[5];
        for (int i = 0; i < primitiveUtilization.length; i++) {
            primitiveUtilization[i]=i+1.0;
            System.out.println(primitiveUtilization[i]);
        }
        System.out.println("______________________");
        ArrayList<Double> arrayList1 = new ArrayList<>(primitiveUtilization.length);
        Collections.addAll(arrayList1,primitiveUtilization);
        //取从位置为1到最后一个的数据
        List<Double> doubleList = arrayList1.subList(1,primitiveUtilization.length);
        Double[] newDouble=new Double[doubleList.size()];
        Double[] doubles = doubleList.toArray(newDouble);
        for (int i = 0; i < doubles.length; i++) {
            System.out.println(doubles[i]);
        }
        System.out.println(doubles);

    }
}
