Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Collection;

public class Main {
    public static int[] toIntArray(String[] ss) {
        int[] r = new int[ss.length];
        for (int i = 0; i < r.length; i++) {
            r[i] = Integer.valueOf(ss[i]);
        }
        return r;
    }

    public static int[] toIntArray(Collection<Integer> list) {
        return toPrimitive(list.toArray(new Integer[0]));
    }

    public static int[] toPrimitive(Integer[] array) {
        int[] r = new int[array.length];
        for (int i = 0; i < array.length; i++) {
            r[i] = array[i];
        }
        return r;
    }
}