You are viewing a single comment's thread. Return to all comments →
public static String encryption(String s) { StringBuilder result = new StringBuilder(); s = s.replaceAll("\s", ""); int n = s.length(); int row = (int) Math.sqrt(n); int column = (row * row == n) ? row : row + 1; for (int i = 0; i < column; i++) { for (int j = i; j < n; j += column) { result.append(s.charAt(j)); } result.append(" ");
} return result.toString(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Encryption
You are viewing a single comment's thread. Return to all comments →
public static String encryption(String s) { StringBuilder result = new StringBuilder(); s = s.replaceAll("\s", ""); int n = s.length(); int row = (int) Math.sqrt(n); int column = (row * row == n) ? row : row + 1; for (int i = 0; i < column; i++) { for (int j = i; j < n; j += column) { result.append(s.charAt(j)); } result.append(" ");