Java Long Number Array Create toLongArray(double[][] array)

Here you can find the source of toLongArray(double[][] array)

Description

to Long Array

License

Open Source License

Declaration

public static long[][] toLongArray(double[][] array) 

Method Source Code

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

public class Main {
    public static long[][] toLongArray(double[][] array) {
        int nr = array.length;
        int nc = array[0].length;
        long[][] ret = new long[nr][nc];
        for (int i = 0; i < nr; i++) {
            for (int j = 0; j < nc; j++) {
                ret[i][j] = (long) array[i][j];
            }/*from  w w w  .j av a 2 s  .c  o m*/
        }
        return ret;
    }

    public static long[][] toLongArray(float[][] array) {
        int nr = array.length;
        int nc = array[0].length;
        long[][] ret = new long[nr][nc];
        for (int i = 0; i < nr; i++) {
            for (int j = 0; j < nc; j++) {
                ret[i][j] = (long) array[i][j];
            }
        }
        return ret;
    }

    public static long[][] toLongArray(int[][] array) {
        int nr = array.length;
        int nc = array[0].length;
        long[][] ret = new long[nr][nc];
        for (int i = 0; i < nr; i++) {
            for (int j = 0; j < nc; j++) {
                ret[i][j] = (long) array[i][j];
            }
        }
        return ret;
    }

    public static long[][] toLongArray(byte[][] array) {
        int nr = array.length;
        int nc = array[0].length;
        long[][] ret = new long[nr][nc];
        for (int i = 0; i < nr; i++) {
            for (int j = 0; j < nc; j++) {
                ret[i][j] = (long) array[i][j];
            }
        }
        return ret;
    }

    public static long[][] toLongArray(char[][] array) {
        int nr = array.length;
        int nc = array[0].length;
        long[][] ret = new long[nr][nc];
        for (int i = 0; i < nr; i++) {
            for (int j = 0; j < nc; j++) {
                ret[i][j] = (long) array[i][j];
            }
        }
        return ret;
    }

    public static long[][] toLongArray(String[][] array) {
        int nr = array.length;
        int nc = array[0].length;
        long[][] ret = new long[nr][nc];
        for (int i = 0; i < nr; i++) {
            for (int j = 0; j < nc; j++) {
                ret[i][j] = Long.parseLong(array[i][j]);
            }
        }
        return ret;
    }
}

Related

  1. toLongArray(boolean[] array)
  2. toLongArray(byte[] array)
  3. toLongArray(byte[] byteArray)
  4. toLongArray(byte[] byteArray)
  5. toLongArray(byte[] data)
  6. toLongArray(final byte[] array)
  7. toLongArray(final int[] in)
  8. toLongArray(final long[] longs)
  9. toLongArray(int... coordinates)