Пример #1
0
 private int findIndex2(String rule) {
   rule = rule.trim();
   if (rule.startsWith("m")) {
     int n = Integer.parseInt(rule.substring(1));
     return -1 * Math.abs(n);
   }
   return Integer.parseInt(rule);
 }
Пример #2
0
 protected int distanceTo(int[] p1, int[] p2) {
   return Math.abs(p1[0] - p2[0]) + Math.abs(p1[1] - p2[1]);
 }