import javax.swing.*;
import java.util.Locale;

 public class array2D  
 {
 public static void main(String[] args)
 {
     int a1[][]={{1,2,3},{4,5,6}};
     int a2[][]={{1,2},{4}};
     String s="2D array output : ";
     String s1="a1 =\n"+output2D(a1);
     s1+="a2 = \n"+output2D(a2);
     JOptionPane.showMessageDialog(null,s1,s,JOptionPane.PLAIN_MESSAGE);
}
 public static String output2D(int a[][])
 {
 Locale tr=new Locale("TR");
 int x=25;
 String s1="";
   for(int i=0;i<a.length;i++)
   {  for(int j=0;j<a[i].length;j++)
    { s1+=String.format(tr," %10d ",a[i][j]);}
   s1+="\n";
   }
   return s1;
 }}
