Java Array Convert to toIntArray(Integer[] data)

Here you can find the source of toIntArray(Integer[] data)

Description

to Int Array

License

Open Source License

Declaration

public static int[] toIntArray(Integer[] data) 

Method Source Code

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

import java.util.List;

public class Main {
    public static int[] toIntArray(Integer[] data) {
        int[] result = new int[data.length];

        for (int i = 0; i < data.length; i++)
            result[i] = data[i].intValue();

        return result;
    }/*  w w w  .  jav a 2  s .c o m*/

    public static int[] toIntArray(List<Integer> data) {
        int[] result = new int[data.size()];

        for (int i = 0; i < data.size(); i++)
            result[i] = data.get(i).intValue();

        return result;
    }
}

Related

  1. toDoubleArray(Double[] list)
  2. toDoubleArray(final int[] intArray)
  3. toFloatArray(final double[] doubles)
  4. toInt(Integer[] arr)
  5. toIntArray(double[] a)
  6. toLongArray(int[] array)
  7. toLongArray(String[] array)