Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public class HelloWorld {
  2.  
  3. public static final String chars = "`~1!2@3#4$5%6^7&8*9(0)-_=+qwertyuiop[{]}asdfghjkl;:zxcvbnm,<.>/?";
  4. public static final int length = chars.length();
  5. public static int limit = 2;
  6.  
  7. public static void main(String []args) {
  8. double max = Math.pow(chars.length(), limit);
  9. System.out.println("Test: " + find(4096 - 1));
  10. }
  11.  
  12. public static String find(int i) {
  13. String base = String.valueOf(i);
  14. String result = "";
  15.  
  16. if (i < length) {
  17. result += chars.substring(i, i + 1);
  18. } else {
  19. int divide = i / length;
  20. int multiply = divide * length;
  21.  
  22. if (divide >= length) {
  23. return "NULL";
  24. }
  25. result += chars.substring(divide, divide + 1);
  26.  
  27. i -= multiply;
  28. result += chars.substring(i, i + 1);
  29. }
  30. return result;
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement