code: private static long getLong(final char[] charArr, final int index, final int rem) {
      long out = 0L;
      for (int i = rem; i-- > 0;) { //i= 3,2,1,0
        final char c = charArr[index + i];
        out ^= (c & 0xFFFFL) << (i * 16); //equivalent to |=
      }
      return out;
    }
docs: Gets a long from the given char array starting at the given char array index and continuing for
  remainder (rem) chars. The chars are extracted in little-endian order. There is no limit
  checking.
  
  @param charArr The given input char array.
  @param index Zero-based index from the start of the char array.
  @param rem Remainder chars. An integer in the range [1,4].
  @return long