Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. private static final int[][] input = new int[][]
  2. {{5, 5, 5, 5, 5, 5, 5, 5, 5, 5},
  3. {4, 4, 4, 4, 4, 4, 4, 4, 4, 4},
  4. {0, 5, 5, 5, 5, 5, 0, 0, 5, 5},
  5. {0, 5, 5, 5, 5, 5, 0, 0, 5, 5},
  6. {0, 5, 5, 5, 5, 5, 0, 0, 5, 5},
  7. {5, 4, 4, 4, 4, 4, 5, 5, 4, 4},
  8. {5, 5, 5, 5, 4, 5, 5, 5, 5, 5},
  9. {0, 5, 5, 5, 5, 5, 0, 0, 5, 5},
  10. {0, 4, 4, 4, 5, 4, 0, 0, 4, 4},
  11. {4, 5, 5, 5, 5, 5, 4, 4, 5, 5}};
  12. private static int[][] train = input;
  13.  
  14. private static final int[] indexes = new int[] {2, 3, 2, 4, 4, 9, 8, 5, 2, 1};
  15.  
  16. private static int[][] test = new int[input.length][input[0].length];
  17.  
  18. public static int[][] checkImplementation(){
  19.  
  20. int[][] input = ArrayHelper.input;
  21. for(int i = 0; i < input.length; i++){
  22. test[i][indexes[i]] = train[i][indexes[i]];
  23. train[i][indexes[i]] = 0;
  24. }
  25.  
  26. return train;
  27. }
  28.  
  29. public static String[][] checkImplementationResult(double[][] result){
  30. DecimalFormat dec = new DecimalFormat("#0.00");
  31. String[][] resultString = new String[input.length][input[0].length];
  32. for(int i = 0; i < input.length; i++){
  33. for(int j = 0; j < input[0].length; j++) {
  34. if(j != indexes[i]) {
  35. resultString[i][j] = ArrayHelper.input[i][j] + "=>" + dec.format(result[i][j]) + " |";
  36. } else {
  37. resultString[i][j] = ArrayHelper.test[i][j] + "=>" + dec.format(result[i][j]) + " |";
  38. }
  39. }
  40. }
  41. return resultString;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement