how to convert string abcdefghijklmnop to a 4x4 matrix in java? -
i trying convert string matrix of 4x4 size. matrix should contain elements same of string. eg.
string="1234567890111213141516"; i need convert 4x4 matrix in java.
a[0][0]=1; a[0][1]=2; and on. can suggest me code same?
for reading string s = "1234567890abcdefghij", can add below code snippet :
char[][] = new char[4][4]; (int = 0; < 4; i++) { (int j = 0; j < 4; j++) { a[i][j] = s.charat(4 * + j); } } this you. work 1 digit character only.
Comments
Post a Comment