code: public static long[] toLongArray(Collection<Long> collection) {
          long[] collectionArray = new long[collection.size()];
          int index = 0;
          for (Long item : collection) {
              collectionArray[index++] = item;
          }
          return collectionArray;
      }
docs: Converts a {@link Collection<Long>} to a primitive {@code long[]} array.
  
  @param collection the given collection
  @return a primitive long[] array
  @throws NullPointerException if collection is {@code null}