code: public static long shortArrayToLong(final short[] src, final int srcPos, final long dstInit, final int dstPos,
              final int nShorts) {
          if (src.length == 0 && srcPos == 0 || 0 == nShorts) {
              return dstInit;
          }
          if ((nShorts - 1) * 16 + dstPos >= 64) {
              throw new IllegalArgumentException("(nShorts-1)*16+dstPos is greater or equal to than 64");
          }
          long out = dstInit;
          for (int i = 0; i < nShorts; i++) {
              final int shift = i * 16 + dstPos;
              final long bits = (0xffffL & src[i + srcPos]) << shift;
              final long mask = 0xffffL << shift;
              out = (out & ~mask) | bits;
          }
          return out;
      }
docs: <p>
  Converts an array of short into a long using the default (little endian, Lsb0) byte and
  bit ordering.
  </p>
  
  @param src the short array to convert
  @param srcPos the position in {@code src}, in short unit, from where to start the
  conversion
  @param dstInit initial value of the destination long
  @param dstPos the position of the lsb, in bits, in the result long
  @param nShorts the number of shorts to convert
  @return a long containing the selected bits
  @throws NullPointerException if {@code src} is {@code null}
  @throws IllegalArgumentException if {@code (nShorts-1)*16+dstPos >= 64}
  @throws ArrayIndexOutOfBoundsException if {@code srcPos + nShorts > src.length}