int[][]x;//define for(int i=0;i<x.length;i++){ for(int j=0;j<x[i].length;j++){ //dp something with x[i][j] } }