Java Char Array Create toCharArray(double[][] array)

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

Description

to Char Array

License

Open Source License

Declaration

public static char[][] toCharArray(double[][] array) 

Method Source Code

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

public class Main {
    public static char[][] toCharArray(double[][] array) {
        int nr = array.length;
        int nc = array[0].length;
        char[][] ret = new char[nr][nc];
        for (int i = 0; i < nr; i++) {
            for (int j = 0; j < nc; j++) {
                ret[i][j] = (char) array[i][j];
            }/*w w  w .j  a v a  2s  .co m*/
        }
        return ret;
    }

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

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

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

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

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

Related

  1. toCharArray(char... values)
  2. toCharArray(CharSequence chars)
  3. toCharArray(CharSequence charSequence)
  4. toCharArray(CharSequence charSequence)
  5. toCharArray(CharSequence cs)
  6. toCharArray(final byte[] array)
  7. toCharArray(int number, int exactArrayLength)
  8. toCharArray(String map)
  9. toCharArray(String s)