Here you can find the source of toInt(double[] array)
Parameter | Description |
---|---|
array | Double array. |
public static int[] toInt(double[] array)
//package com.java2s; // under the BSD license. The original license terms are given below: public class Main { /**/*w w w. j a va 2 s. c o m*/ * 1-D Double array to integer array. * @param array Double array. * @return Integer array. */ public static int[] toInt(double[] array) { int[] n = new int[array.length]; for (int i = 0; i < array.length; i++) { n[i] = (int) array[i]; } return n; } /** * 2-D Double array to integer array. * @param array Double array. * @return Integer array. */ public static int[][] toInt(double[][] array) { int[][] n = new int[array.length][array[0].length]; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[0].length; j++) { n[i][j] = (int) array[i][j]; } } return n; } /** * 1-D Float array to integer array. * @param array Float array. * @return Integer array. */ public static int[] toInt(float[] array) { int[] n = new int[array.length]; for (int i = 0; i < array.length; i++) { n[i] = (int) array[i]; } return n; } /** * 2-D Float array to integer array. * @param array Float array. * @return Integer array. */ public static int[][] toInt(float[][] array) { int[][] n = new int[array.length][array[0].length]; for (int i = 0; i < array.length; i++) { for (int j = 0; j < array[0].length; j++) { n[i][j] = (int) array[i][j]; } } return n; } }