Java Array Convert to toInt(Integer[] arr)

Here you can find the source of toInt(Integer[] arr)

Description

to Int

License

Open Source License

Declaration

public static int[] toInt(Integer[] arr) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {

    public static int[] toInt(Integer[] arr) {
        if (arr == null) {
            return null;
        }//  ww w . j  a v  a2 s.  c om

        int[] ret = new int[arr.length];
        for (int i = 0; i < arr.length; i++) {
            ret[i] = arr[i];
        }
        return ret;
    }

    public static int[] toInt(List<Integer> list) {
        if (list == null) {
            return null;
        }

        int[] ret = new int[list.size()];
        for (int i = 0; i < list.size(); i++) {
            ret[i] = list.get(i);
        }

        return ret;
    }
}

Related

  1. convertArrayValue(Object value, Class type)
  2. toDoubleArray(byte[] data)
  3. toDoubleArray(Double[] list)
  4. toDoubleArray(final int[] intArray)
  5. toFloatArray(final double[] doubles)
  6. toIntArray(double[] a)
  7. toIntArray(Integer[] data)
  8. toLongArray(int[] array)
  9. toLongArray(String[] array)