java - Create two dimensional boolean array from two other arrays -


i have 2 dimensional integer array , 2 dimensional double array. if value in double array less integer value @ same position of 2 dimensional array, in part of boolean array value true. if greater, boolean false.

how go on this?

this tried far:

public static boolean[][] compareintdouble(int[][] pizza, double[][] pasta) {     boolean x = true;      (int hotdog=0; hotdog < pizza.length; hotdog++) {         (int toast=0; toast < pizza[hotdog].length; toast++) {             pizza[hotdog][toast] = hotdog * 10 + toast;              if (pasta[1][1] > pizza[1][1]) {                 x = true;             } else {                 x = false;             }              if (pasta[1][2] > pizza[1][2]) {                 x = true;             } else {                 x = false             }         }     } } 

picture of code

public static void main(string... args) throws ioexception {     int[][] t1 = new int[2][2];     t1[0][0] = 0;     t1[0][1] = 1;     t1[1][0] = 2;     t1[1][1] = 3;      double[][] t2 = new double[2][2];     t2[0][0] = 3;     t2[0][1] = 2;     t2[1][0] = 1;     t2[1][1] = 0;      boolean[][] f = new boolean[2][2];      (int = 0; < 2; i++) {         (int j = 0; j < 2; j++) {             if (t1[i][j] > t2[i][j]) {                 f[i][j] = true;             } else {                 f[i][j] = false;             }             system.out.println(i+" "+j+" :"+f[i][j]);         }     } } 

even tho should try first here have working example


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -