code: private static int findOther(int[] vs, int u, int x) {
          for (int v : vs) {
              if (v != u && v != x) return v;
          }
          throw new IllegalArgumentException("vs[] did not contain another vertex");
      }
docs: Finds a vertex in 'vs' which is not 'u' or 'x'.
  .
  @param vs fixed size array of 3 elements
  @param u  a vertex in 'vs'
  @param x  another vertex in 'vs'
  @return the other vertex