private void readDatatypeArray(int type, Document document, String key) {
        ValueList tempList = valueList.getNextList();
        if (tempList == null) {
            document.put(key,null);
            return;
        }
        int len = tempList.length();
        Object[] array =  null;
        if (type == ElementType.TYPE_STRING_ARRAY) {
            array = new String[len];
            for (int i=0;i<len;i++) {
                array[i] = tempList.getNextString();
            }
        } else if (type == ElementType.TYPE_INTEGER_ARRAY) {
            array = new Integer[len];
            for (int i=0;i<len;i++) {
                array[i] = tempList.getNextInt();
            }
        } else if (type == ElementType.TYPE_LONG_ARRAY) {
            array = new Long[len];
            for (int i=0;i<len;i++) {
                array[i] = tempList.getNextLong();
            }
        } else if (type == ElementType.TYPE_DOUBLE_ARRAY) {
            array = new Double[len];
            for (int i=0;i<len;i++) {
                array[i] = tempList.getNextDouble();
            }
        }
        document.put(key,array);
    }