dap4/d4core/src/main/java/dap4/core/util/DapUtil.java
static public Index
    slicesToIndex(List<Slice> slices)
            throws DapException
    {
        long[] positions = new long[slices.size()];
        long[] dimsizes = new long[slices.size()];
        for(int i = 0; i < positions.length; i++) {
            Slice s = slices.get(i);
            if(s.getCount() != 1)
                throw new DapException("Attempt to convert non-singleton sliceset to index");
            positions[i] = s.getFirst();
            dimsizes[i] = s.getMax();
        }
        return new Index(positions, dimsizes);
    }
static public Index
    slicesToIndex(List<Slice> slices)
            throws DapException
    {
        long[] positions = new long[slices.size()];
        long[] dimsizes = new long[slices.size()];
        for(int i = 0; i < positions.length; i++) {
            Slice s = slices.get(i);
            if(s.getCount() != 1)
                throw new DapException("Attempt to convert non-singleton sliceset to index");
            positions[i] = s.getFirst();
            dimsizes[i] = s.getMax();
        }
        return new Index(positions, dimsizes);
    }
If a set of slices refers to a single position,
then return the corresponding Index. Otherwise,
throw Exception.

@param slices
@return Index corresponding to slices
@throws DapException