public class test { private String key; private String plain; String [][] plainArray = new String[4][4]; public String[][] getPlainArray(String plain) { int begin=0,end=2; for(int i=0;i<=3;i++){ for(int j=0;j<=3;j++) { plainArray[i][j]=plain.substring(begin,end); begin = begin+2; end=end+2; } } return plainArray; } public static void main(String arg[]) { String plain="0123456789ABCDEF0123456789ABCDEF"; String key= "d2f60c436e7ccebb8eaceaf3f86c8bad"; test t = new test(); for(int i=0;i<=3;i++) { for(int j=0;j<=3;j++) { System.out.print(t.plainArray[i][j]); } System.out.println(); } }//end of main }//end of class