Example usage for java.util Calendar MILLISECOND

List of usage examples for java.util Calendar MILLISECOND

Introduction

In this page you can find the example usage for java.util Calendar MILLISECOND.

Prototype

int MILLISECOND

To view the source code for java.util Calendar MILLISECOND.

Click Source Link

Document

Field number for get and set indicating the millisecond within the second.

Usage

From source file:io.apiman.manager.api.core.metrics.AbstractMetricsAccessor.java

/**
 * Generate the histogram buckets based on the time frame requested and the interval.  This will
 * add an entry for each 'slot' or 'bucket' in the histogram, setting the count to 0.
 * @param rval/*from   w  w w  . j a va2  s  .c  o  m*/
 * @param from
 * @param to
 * @param interval
 */
public static <T extends HistogramDataPoint, K> Map<K, T> generateHistogramSkeleton(HistogramBean<T> rval,
        DateTime from, DateTime to, HistogramIntervalType interval, Class<T> dataType, Class<K> keyType) {
    Map<K, T> index = new HashMap<>();

    Calendar fromCal = from.toGregorianCalendar();
    Calendar toCal = to.toGregorianCalendar();

    switch (interval) {
    case day:
        fromCal.set(Calendar.HOUR_OF_DAY, 0);
        fromCal.set(Calendar.MINUTE, 0);
        fromCal.set(Calendar.SECOND, 0);
        fromCal.set(Calendar.MILLISECOND, 0);
        break;
    case hour:
        fromCal.set(Calendar.MINUTE, 0);
        fromCal.set(Calendar.SECOND, 0);
        fromCal.set(Calendar.MILLISECOND, 0);
        break;
    case minute:
        fromCal.set(Calendar.SECOND, 0);
        fromCal.set(Calendar.MILLISECOND, 0);
        break;
    case month:
        fromCal.set(Calendar.DAY_OF_MONTH, 1);
        fromCal.set(Calendar.HOUR_OF_DAY, 0);
        fromCal.set(Calendar.MINUTE, 0);
        fromCal.set(Calendar.SECOND, 0);
        fromCal.set(Calendar.MILLISECOND, 0);
        break;
    case week:
        fromCal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
        fromCal.set(Calendar.HOUR_OF_DAY, 0);
        fromCal.set(Calendar.MINUTE, 0);
        fromCal.set(Calendar.SECOND, 0);
        fromCal.set(Calendar.MILLISECOND, 0);
        break;
    default:
        break;
    }

    while (fromCal.before(toCal)) {
        String label = formatDateWithMillis(fromCal);
        T point;
        try {
            point = dataType.newInstance();
        } catch (InstantiationException | IllegalAccessException e) {
            throw new RuntimeException(e);
        }
        point.setLabel(label);
        rval.addDataPoint(point);
        if (keyType == String.class) {
            index.put((K) label, point);
        } else {
            index.put((K) new Long(fromCal.getTimeInMillis()), point);
        }
        switch (interval) {
        case day:
            fromCal.add(Calendar.DAY_OF_YEAR, 1);
            break;
        case hour:
            fromCal.add(Calendar.HOUR_OF_DAY, 1);
            break;
        case minute:
            fromCal.add(Calendar.MINUTE, 1);
            break;
        case month:
            fromCal.add(Calendar.MONTH, 1);
            break;
        case week:
            fromCal.add(Calendar.WEEK_OF_YEAR, 1);
            break;
        default:
            break;
        }
    }

    return index;

}

From source file:net.ontopia.topicmaps.db2tm.SynchronizationServlet.java

@Override
public void init(ServletConfig config) throws ServletException {
    super.init(config);
    log.info("Initializing synchronization servlet.");

    try {/*from w  ww  .  ja v  a2  s.co  m*/
        // no default starttime
        Date time = null;
        long delay = 180 * 1000;
        String timeval = config.getInitParameter("start-time");
        if (timeval != null) {
            Date d = df.parse(timeval);
            Calendar c0 = Calendar.getInstance();
            Calendar c = Calendar.getInstance();
            c.set(Calendar.HOUR_OF_DAY, 1);
            c.set(Calendar.MINUTE, 0);
            c.add(Calendar.MILLISECOND, (int) d.getTime());
            if (c.before(c0))
                c.add(Calendar.HOUR_OF_DAY, 24);
            time = c.getTime();
            log.info("Setting synchronization start time to {} ms.", time);
        } else {
            // default delay is 180 sec.
            delay = getLongProperty(config, "delay", delay);
            log.info("Setting synchronization delay to {} ms.", delay);
        }

        // default interval is 24 hours.
        long interval = getLongProperty(config, "interval", 1000 * 60 * 60 * 24);
        log.info("Setting synchronization interval to {} ms.", interval);

        // load relation mapping file
        String mapping = config.getInitParameter("mapping");
        if (mapping == null)
            throw new OntopiaRuntimeException("Servlet init-param 'mapping' must be specified.");

        // get relation names (comma separated)
        Collection<String> relnames = null;
        String relations = config.getInitParameter("relations");
        if (relations != null)
            relnames = Arrays.asList(StringUtils.split(relations, ","));

        // get hold of the topic map
        String tmid = config.getInitParameter("topicmap");
        if (tmid == null)
            throw new OntopiaRuntimeException("Servlet init-param 'topicmap' must be specified.");
        TopicMapRepositoryIF rep = NavigatorUtils.getTopicMapRepository(config.getServletContext());
        TopicMapReferenceIF ref = rep.getReferenceByKey(tmid);

        // make sure delay is at least 10 seconds to make sure that it doesn't
        // start too early
        if (time == null)
            task = new SynchronizationTask(config.getServletName(), (delay < 10000 ? 10000 : delay), interval);
        else
            task = new SynchronizationTask(config.getServletName(), time, interval);

        task.setRelationMappingFile(mapping);
        task.setRelationNames(relnames);
        task.setTopicMapReference(ref);
        task.setBaseLocator(null);

    } catch (Exception e) {
        throw new ServletException(e);
    }
}

From source file:com.sshdemo.common.schedule.generate.validator.JobInfoValidator.java

protected void validateJobTrigger(ValidationErrorsable errors, JobInfo job) throws BaseException {
    JobTrigger trigger = job.getTrigger();
    if (trigger == null) {
        errors.add(new ValidationError("error.alqc.job.no.trigger", null, "??.",
                "trigger"));
        return;//from  w w  w .  ja va 2 s  .co m
    }

    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    Date now = calendar.getTime();
    String tzId = trigger.getTimeZone();
    if (tzId != null && tzId.length() > 0) {
        TimeZone tz = TimeZone.getTimeZone(tzId);
        now = DateBuilder.translateTime(now, tz, TimeZone.getDefault());
    }

    if (trigger.getStartType() == JobTrigger.START_TYPE_SCHEDULE) {
        Date startDate = trigger.getStartDate();
        if (startDate == null) {
            errors.add(new ValidationError("error.not.empty", null, "?.",
                    "trigger.startDate"));
            //            } else if (startDate.before(now)) {
            //                errors.add(new ValidationError("error.before.current.date", null, "?.", "trigger.startDate"));
        }
    }

    if (trigger.getEndDate() != null) {
        if (trigger.getStartType() == JobTrigger.START_TYPE_NOW) {
            if (trigger.getEndDate().before(now)) {
                errors.add(new ValidationError("error.before.current.date", null,
                        "??.", "trigger.endDate"));
            }
        } else if (trigger.getStartType() == JobTrigger.START_TYPE_SCHEDULE) {
            if (trigger.getEndDate().before(now)) {
                errors.add(new ValidationError("error.before.current.date", null,
                        "??.", "trigger.endDate"));
            }
            if (trigger.getStartDate() != null && trigger.getEndDate().before(trigger.getStartDate())) {
                errors.add(new ValidationError("error.before.start.date", null,
                        "??.", "trigger.endDate"));
            }
        }
    }

    if (trigger instanceof JobSimpleTrigger) {
        validateJobSimpleTrigger(errors, (JobSimpleTrigger) trigger);
    } else if (trigger instanceof JobCalendarTrigger) {
        validateJobCalendarTrigger(errors, (JobCalendarTrigger) trigger);
    } else {
        //            String quotedTriggerType = "\"" + trigger.getClass().getName() + "\"";
        //            throw new JSException("jsexception.job.unknown.trigger.type", new Object[] {quotedTriggerType});
        throw new BaseException("??",
                "??");
    }
}

From source file:com.streamsets.pipeline.stage.origin.jdbc.table.AllTypesIT.java

private static void populateRecords() {
    Record record = RecordCreator.create();
    LinkedHashMap<String, Field> fields;
    AtomicInteger id_field = new AtomicInteger(0);

    //CHAR_AND_BINARY
    fields = new LinkedHashMap<>();
    createIdField(fields, id_field);//from   w w  w  .  j ava 2 s.c  o  m
    fields.put("char1", Field.create("abcdefghij"));
    fields.put("varchar1", Field.create(UUID.randomUUID().toString()));
    fields.put("clob1", Field.create(UUID.randomUUID().toString()));
    fields.put("varbinary1", Field.create(UUID.randomUUID().toString().getBytes()));
    fields.put("blob1", Field.create(UUID.randomUUID().toString().getBytes()));
    record.set(Field.createListMap(fields));

    TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("CHAR_AND_BINARY").getRight().add(record);

    //Date and time
    record = RecordCreator.create();
    fields = new LinkedHashMap<>();
    createIdField(fields, id_field);
    Calendar calendar = Calendar.getInstance();

    calendar.set(Calendar.HOUR_OF_DAY, 0);
    calendar.set(Calendar.MINUTE, 0);
    calendar.set(Calendar.SECOND, 0);
    calendar.set(Calendar.MILLISECOND, 0);
    fields.put("date1", Field.create(Field.Type.DATE, calendar.getTime()));
    calendar.setTimeInMillis(System.currentTimeMillis());

    calendar.set(Calendar.MILLISECOND, 0);
    fields.put("timestamp1", Field.create(Field.Type.DATETIME, calendar.getTime()));
    fields.put("datetime1", Field.create(Field.Type.DATETIME, calendar.getTime()));
    calendar.setTimeInMillis(System.currentTimeMillis());

    calendar.set(Calendar.YEAR, 1970);
    calendar.set(Calendar.MONTH, Calendar.JANUARY);
    calendar.set(Calendar.DAY_OF_MONTH, 1);
    calendar.set(Calendar.MILLISECOND, 0);
    fields.put("time1", Field.create(Field.Type.TIME, calendar.getTime()));
    calendar.setTimeInMillis(System.currentTimeMillis());

    record.set(Field.createListMap(fields));
    TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("DATE_AND_TIME").getRight().add(record);

    //DIFFERENT_INTS
    record = RecordCreator.create();
    fields = new LinkedHashMap<>();
    createIdField(fields, id_field);
    fields.put("int1", Field.create(Field.Type.INTEGER, Integer.MIN_VALUE));
    fields.put("int2", Field.create(Field.Type.INTEGER, Integer.MIN_VALUE));
    fields.put("mediumint1", Field.create(Field.Type.INTEGER, Integer.MIN_VALUE));
    fields.put("tinyint1", Field.create(Field.Type.SHORT, -128));
    fields.put("smallint1", Field.create(Field.Type.SHORT, Short.MIN_VALUE));
    fields.put("bigint1", Field.create(Field.Type.LONG, Long.MIN_VALUE));
    record.set(Field.createListMap(fields));
    TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("DIFFERENT_INTS").getRight().add(record);

    record = RecordCreator.create();
    fields = new LinkedHashMap<>();
    createIdField(fields, id_field);
    fields.put("int1", Field.create(Field.Type.INTEGER, Integer.MAX_VALUE));
    fields.put("int2", Field.create(Field.Type.INTEGER, Integer.MAX_VALUE));
    fields.put("mediumint1", Field.create(Field.Type.INTEGER, Integer.MAX_VALUE));
    fields.put("tinyint1", Field.create(Field.Type.SHORT, 127));
    fields.put("smallint1", Field.create(Field.Type.SHORT, Short.MAX_VALUE));
    fields.put("bigint1", Field.create(Field.Type.LONG, Long.MAX_VALUE));
    record.set(Field.createListMap(fields));
    TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("DIFFERENT_INTS").getRight().add(record);

    //FLOATING_PT_INTS
    record = RecordCreator.create();
    fields = new LinkedHashMap<>();
    createIdField(fields, id_field);
    fields.put("decimal1", Field.create(Field.Type.DECIMAL, new BigDecimal("12.345")));
    fields.put("number1", Field.create(Field.Type.DECIMAL, new BigDecimal("0.12345")));
    fields.put("double1", Field.create(Field.Type.DOUBLE, 123.456));
    fields.put("real1", Field.create(Field.Type.FLOAT, 12.34));
    fields.put("floatdouble1", Field.create(Field.Type.DOUBLE, Double.MAX_VALUE));
    record.set(Field.createListMap(fields));
    TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("FLOATING_PT_INTS").getRight().add(record);

    record = RecordCreator.create();
    fields = new LinkedHashMap<>();
    createIdField(fields, id_field);
    fields.put("decimal1", Field.create(Field.Type.DECIMAL, new BigDecimal("-12.345")));
    fields.put("number1", Field.create(Field.Type.DECIMAL, new BigDecimal("-0.12345")));
    fields.put("double1", Field.create(Field.Type.DOUBLE, -123.456));
    fields.put("real1", Field.create(Field.Type.FLOAT, -12.34));
    fields.put("floatdouble1", Field.create(Field.Type.DOUBLE, Double.MIN_VALUE));
    record.set(Field.createListMap(fields));
    TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("FLOATING_PT_INTS").getRight().add(record);

    //OTHER_TYPES
    record = RecordCreator.create();
    fields = new LinkedHashMap<>();
    createIdField(fields, id_field);
    fields.put("boolean1", Field.create(Field.Type.BOOLEAN, true));
    record.set(Field.createListMap(fields));
    TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("OTHER_TYPES").getRight().add(record);

    record = RecordCreator.create();
    fields = new LinkedHashMap<>();
    createIdField(fields, id_field);
    fields.put("boolean1", Field.create(Field.Type.BOOLEAN, false));
    record.set(Field.createListMap(fields));
    TABLE_TO_TEMPLATE_AND_RECORDS_MAP.get("OTHER_TYPES").getRight().add(record);
}

From source file:DateUtil.java

/**
 * Returns a Date set to the first possible millisecond of the hour.
 * If a null day is passed in, a new Date is created.
 *//*from  www.  ja  va2s  .co m*/
public static Date getStartOfHour(Date day, Calendar cal) {
    if (day == null)
        day = new Date();
    cal.setTime(day);
    cal.set(Calendar.MINUTE, cal.getMinimum(Calendar.MINUTE));
    cal.set(Calendar.SECOND, cal.getMinimum(Calendar.SECOND));
    cal.set(Calendar.MILLISECOND, cal.getMinimum(Calendar.MILLISECOND));
    return cal.getTime();
}

From source file:Time.java

public void setMilliSeconds(int milliSeconds) {
    calendar_.set(Calendar.MILLISECOND, milliSeconds);
}

From source file:Main.java

/**
 * <p>Internal calculation method.</p>
 * /*from   w ww. j a  v a2 s  . c o m*/
 * @param val  the calendar
 * @param field  the field constant
 * @param round  true to round, false to truncate
 * @throws ArithmeticException if the year is over 280 million
 */
private static void modify(Calendar val, int field, boolean round) {
    if (val.get(Calendar.YEAR) > 280000000) {
        throw new ArithmeticException("Calendar value too large for accurate calculations");
    }

    if (field == Calendar.MILLISECOND) {
        return;
    }

    // ----------------- Fix for LANG-59 ---------------------- START ---------------
    // see http://issues.apache.org/jira/browse/LANG-59
    //
    // Manually truncate milliseconds, seconds and minutes, rather than using
    // Calendar methods.

    Date date = val.getTime();
    long time = date.getTime();
    boolean done = false;

    // truncate milliseconds
    int millisecs = val.get(Calendar.MILLISECOND);
    if (!round || millisecs < 500) {
        time = time - millisecs;
    }
    if (field == Calendar.SECOND) {
        done = true;
    }

    // truncate seconds
    int seconds = val.get(Calendar.SECOND);
    if (!done && (!round || seconds < 30)) {
        time = time - (seconds * 1000L);
    }
    if (field == Calendar.MINUTE) {
        done = true;
    }

    // truncate minutes
    int minutes = val.get(Calendar.MINUTE);
    if (!done && (!round || minutes < 30)) {
        time = time - (minutes * 60000L);
    }

    // reset time
    if (date.getTime() != time) {
        date.setTime(time);
        val.setTime(date);
    }
    // ----------------- Fix for LANG-59 ----------------------- END ----------------

    boolean roundUp = false;
    for (int i = 0; i < fields.length; i++) {
        for (int j = 0; j < fields[i].length; j++) {
            if (fields[i][j] == field) {
                //This is our field... we stop looping
                if (round && roundUp) {
                    if (field == DateUtils.SEMI_MONTH) {
                        //This is a special case that's hard to generalize
                        //If the date is 1, we round up to 16, otherwise
                        //  we subtract 15 days and add 1 month
                        if (val.get(Calendar.DATE) == 1) {
                            val.add(Calendar.DATE, 15);
                        } else {
                            val.add(Calendar.DATE, -15);
                            val.add(Calendar.MONTH, 1);
                        }
                    } else {
                        //We need at add one to this field since the
                        //  last number causes us to round up
                        val.add(fields[i][0], 1);
                    }
                }
                return;
            }
        }
        //We have various fields that are not easy roundings
        int offset = 0;
        boolean offsetSet = false;
        //These are special types of fields that require different rounding rules
        switch (field) {
        case DateUtils.SEMI_MONTH:
            if (fields[i][0] == Calendar.DATE) {
                //If we're going to drop the DATE field's value,
                //  we want to do this our own way.
                //We need to subtrace 1 since the date has a minimum of 1
                offset = val.get(Calendar.DATE) - 1;
                //If we're above 15 days adjustment, that means we're in the
                //  bottom half of the month and should stay accordingly.
                if (offset >= 15) {
                    offset -= 15;
                }
                //Record whether we're in the top or bottom half of that range
                roundUp = offset > 7;
                offsetSet = true;
            }
            break;
        case Calendar.AM_PM:
            if (fields[i][0] == Calendar.HOUR_OF_DAY) {
                //If we're going to drop the HOUR field's value,
                //  we want to do this our own way.
                offset = val.get(Calendar.HOUR_OF_DAY);
                if (offset >= 12) {
                    offset -= 12;
                }
                roundUp = offset > 6;
                offsetSet = true;
            }
            break;
        }
        if (!offsetSet) {
            int min = val.getActualMinimum(fields[i][0]);
            int max = val.getActualMaximum(fields[i][0]);
            //Calculate the offset from the minimum allowed value
            offset = val.get(fields[i][0]) - min;
            //Set roundUp if this is more than half way between the minimum and maximum
            roundUp = offset > ((max - min) / 2);
        }
        //We need to remove this field
        if (offset != 0) {
            val.set(fields[i][0], val.get(fields[i][0]) - offset);
        }
    }
    throw new IllegalArgumentException("The field " + field + " is not supported");

}

From source file:org.wte4j.FormatDateExpressionTest.java

@Test()
public void formateTimeLongTest() {
    Calendar calendar = Calendar.getInstance(LOCALE);
    calendar.set(1977, 01, 15, 22, 33, 44);
    calendar.set(Calendar.MILLISECOND, 123);

    testFormat(calendar, "format:time(long) value", "22:33:44.123 MEZ");
}

From source file:com.bstek.dorado.core.el.ExpressionUtilsObject.java

public java.util.Date calculateDate(java.util.Date date, String expression) {
    Calendar calendar = Calendar.getInstance();
    calendar.setTime(date);/*w w w . j a  v  a2 s  .c o m*/

    if (StringUtils.isNotBlank(expression)) {
        char fieldChar = 0;
        int field = 0, offset = 0;
        boolean offsetFound = false;
        StringBuffer numText = new StringBuffer();
        for (int i = 0, len = expression.length(); i < len; i++) {
            char c = expression.charAt(i);
            if (c == ' ' || c == ',' || c == ';') {
                if (field != 0) {
                    if (numText.length() == 0) {
                        throw new IllegalArgumentException(
                                "Argument missed for Date field \"" + fieldChar + "\".");
                    }

                    int num = Integer.parseInt(numText.toString());
                    if (offset == 0) {
                        calendar.set(field, num);
                    } else {
                        calendar.add(field, num * offset);
                    }
                }

                fieldChar = 0;
                field = 0;
                offset = 0;
                offsetFound = false;
                numText.setLength(0);
            } else if (field == 0) {
                switch (c) {
                case 'y':
                case 'Y':
                    field = Calendar.YEAR;
                    break;
                case 'M':
                    field = Calendar.MONTH;
                    break;
                case 'd':
                    field = Calendar.DAY_OF_MONTH;
                    break;
                case 'h':
                case 'H':
                    field = Calendar.HOUR_OF_DAY;
                    break;
                case 'm':
                    field = Calendar.MINUTE;
                    break;
                case 's':
                    field = Calendar.SECOND;
                    break;
                case 'z':
                case 'Z':
                    field = Calendar.MILLISECOND;
                    break;
                default:
                    throw new IllegalArgumentException("Unknown Date field \"" + c + "\".");
                }
                fieldChar = c;
            } else if (!offsetFound && numText.length() == 0) {
                if (c == '+') {
                    offset = 1;
                    offsetFound = true;
                } else if (c == '-') {
                    offset = -1;
                    offsetFound = true;
                }
            } else if (c >= '0' && c <= '9') {
                numText.append(c);
            }
        }

        if (field != 0) {
            if (numText.length() == 0) {
                throw new IllegalArgumentException("Argument missed for Date field \"" + fieldChar + "\".");
            }

            int num = Integer.parseInt(numText.toString());
            if (offset == 0) {
                calendar.set(field, num);
            } else {
                calendar.add(field, num * offset);
            }
        }
    }

    return calendar.getTime();
}

From source file:org.craftercms.commerce.client.itest.data.SolrTestDataService.java

public TestProduct testProduct(int i) {

    Calendar cal = new GregorianCalendar();
    cal.setTime(SolrTestDataService.START_TIME);
    cal.set(Calendar.YEAR, cal.get(Calendar.YEAR) + i);
    cal.set(Calendar.DAY_OF_YEAR, Calendar.DAY_OF_YEAR + i);
    cal.set(Calendar.HOUR_OF_DAY, 1);
    cal.set(Calendar.MINUTE, 1);//from  w  w  w .j  a va  2 s .  co m
    cal.set(Calendar.SECOND, 1);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 1);

    TestProduct product = new TestProduct();
    product.setId("product-" + i);
    product.setName("product-" + i + "-name");
    product.setCreatedBy("product-" + i + "-created-by");
    product.setCreationDate(cal.getTime());
    product.setLastModifiedBy("product-" + i + "-modified-by");
    product.setLastModifiedDate(cal.getTime());
    product.setDescription("product-" + i + "-description");

    if (i < 20) {
        // 0-19
        product.category_s = "A";
        product.size_i = 1;
        product.listPrice_f = (float) 15.99;
        cal.set(Calendar.DAY_OF_YEAR, Calendar.DAY_OF_YEAR + 10);
        product.expirationDate_d = cal.getTime();
        product.inStock_b = true;
        product.tags_s_mv[0] = "abc";
        product.tags_s_mv[1] = "def";
        product.tags_s_mv[2] = "efg";
        product.sizes_i_mv[0] = 12;
        product.sizes_i_mv[1] = 13;
        product.sizes_i_mv[2] = 14;
        product.sizes_i_mv[3] = 15;
        product.listPrices_f_mv[0] = (float) 2.3;
        product.listPrices_f_mv[1] = (float) 3.2;
        cal.set(Calendar.DAY_OF_YEAR, 1);
        product.launchDate_d_mv[0] = cal.getTime();
        product.booleanMulti_b_mv[0] = true;
        product.booleanMulti_b_mv[1] = true;
        product.booleanMulti_b_mv[2] = false;
    } else if (i < 50) {
        // 20-49
        product.category_s = "B";
        product.size_i = 2;
        product.listPrice_f = (float) 20.99;
        cal.set(Calendar.DAY_OF_YEAR, Calendar.DAY_OF_YEAR + 20);
        product.expirationDate_d = cal.getTime();
        product.inStock_b = false;
        product.tags_s_mv[0] = "hij";
        product.tags_s_mv[1] = "klm";
        product.tags_s_mv[2] = "nop";
        product.sizes_i_mv[0] = 8;
        product.sizes_i_mv[1] = 10;
        product.sizes_i_mv[2] = 12;
        product.sizes_i_mv[3] = 14;
        product.listPrices_f_mv[0] = (float) 18.34;
        product.listPrices_f_mv[1] = (float) 39.21;
        cal.set(Calendar.DAY_OF_YEAR, 2);
        product.launchDate_d_mv[0] = cal.getTime();
        product.booleanMulti_b_mv[0] = false;
        product.booleanMulti_b_mv[1] = true;
        product.booleanMulti_b_mv[2] = false;
    } else if (i < 90) {
        // 50-89
        product.category_s = "C";
        product.size_i = 3;
        product.listPrice_f = (float) 25.99;
        cal.set(Calendar.DAY_OF_YEAR, Calendar.DAY_OF_YEAR + 30);
        product.expirationDate_d = cal.getTime();
        product.inStock_b = true;
        product.tags_s_mv[0] = "qrs";
        product.tags_s_mv[1] = "tuv";
        product.tags_s_mv[2] = "xyz";
        product.sizes_i_mv[0] = 21;
        product.sizes_i_mv[1] = 9;
        product.sizes_i_mv[2] = 3;
        product.sizes_i_mv[3] = 18;
        product.listPrices_f_mv[0] = (float) 12.3;
        product.listPrices_f_mv[1] = (float) 32.2;
        cal.set(Calendar.DAY_OF_YEAR, 3);
        product.launchDate_d_mv[0] = cal.getTime();
        product.booleanMulti_b_mv[0] = true;
        product.booleanMulti_b_mv[1] = true;
        product.booleanMulti_b_mv[2] = true;
    } else {
        // 90-99
        product.category_s = "D";
        product.size_i = 4;
        product.listPrice_f = (float) 30.99;
        cal.set(Calendar.DAY_OF_YEAR, Calendar.DAY_OF_YEAR + 40);
        product.expirationDate_d = cal.getTime();
        product.inStock_b = false;
        product.tags_s_mv[0] = "bcd";
        product.tags_s_mv[1] = "efg";
        product.tags_s_mv[2] = "hij";
        product.sizes_i_mv[0] = 41;
        product.sizes_i_mv[1] = 12;
        product.sizes_i_mv[2] = 1;
        product.sizes_i_mv[3] = 19;
        product.listPrices_f_mv[0] = (float) 32.33;
        product.listPrices_f_mv[1] = (float) 42.21;
        cal.set(Calendar.DAY_OF_YEAR, 4);
        product.launchDate_d_mv[0] = cal.getTime();
        product.booleanMulti_b_mv[0] = false;
        product.booleanMulti_b_mv[1] = false;
        product.booleanMulti_b_mv[2] = false;
    }

    return product;

}