Java Integer Create toInt(long[] a)

Here you can find the source of toInt(long[] a)

Description

to Int

License

Apache License

Declaration

public static final int[] toInt(long[] a) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static final int[] toInt(long[] a) {
        int[] b = new int[a.length];
        for (int i = 0; i < a.length; i++) {
            b[i] = (int) a[i];
        }/*from  w  ww.  ja  v  a2 s .  c  o  m*/
        return b;
    }

    public static final int[] toInt(double[] a) {
        int[] b = new int[a.length];
        for (int i = 0; i < a.length; i++) {
            b[i] = (int) a[i];
        }
        return b;
    }

    public static final int[] toInt(float[] a) {
        int[] b = new int[a.length];
        for (int i = 0; i < a.length; i++) {
            b[i] = (int) a[i];
        }
        return b;
    }

    public static final int[][] toInt(double[][] a) {
        int[][] b = new int[a.length][a[0].length];
        for (int i = 0; i < a.length; i++)
            for (int j = 0; j < a[0].length; j++) {
                b[i][j] = (int) a[i][j];
            }
        return b;
    }

    public static final int[][] toInt(float[][] a) {
        int[][] b = new int[a.length][a[0].length];
        for (int i = 0; i < a.length; i++)
            for (int j = 0; j < a[0].length; j++) {
                b[i][j] = (int) a[i][j];
            }
        return b;
    }

    public static final int[][][] toInt(boolean[][][] a) {
        int[][][] b = new int[a.length][a[0].length][a[0][0].length];
        for (int i = 0; i < a.length; i++)
            for (int j = 0; j < a[0].length; j++)
                for (int k = 0; k < a[0][0].length; k++) {
                    if (a[i][j][k])
                        b[i][j][k] = 1;
                }
        return b;
    }
}

Related

  1. toInt(Integer i)
  2. toInt(Integer n)
  3. toInt(long l)
  4. toInt(long l)
  5. toInt(long unsignedInt)
  6. toInt(Number num)
  7. toInt(Number value)
  8. toInt(Number wrapped)
  9. toInt(Object bean, int defaultValue)