My conversion from timestamp to calendar was apparently successful, since the data presented appears correct except for the day of the week.
data = (java.util.GregorianCalendar) java.util.GregorianCalendar [time = -125784706799416, areFieldsSet = true, areAllFieldsSet = true, lenient = true, zone = sun.util.calendar.ZoneInfo [id="America / Sao_Paulo", offset = -10800000, dstSavings = 3600000, useDaylight = true, transitions = 129, lastRule = java.util.SimpleTimeZone [id = America / Sao_Paulo, offset = -10800000, dstSavings = 3600000, useDaylight = true, startYear = 0, startMode = 3, startMonth = 9, startDay = 15 , startDayOfWeek = 1, endTimeMode = 0, endTimeMode = 0, endDayOfWeek = 1, endDayOfWeek = 1, startDayOfWeek = 1, startTimeMode = 0, endTimeMode = 0, , YEAR = 2017, MONTH = 1, WEEK_OF_YEAR = 6, WEEK_OF_MONTH = 1, DAY_OF_MONTH = 2, DAY_OF_YEAR = 33, DAY_OF_WEEK = 2, DAY_OF_WEEK_IN_MONTH = 1, AM_PM = 0, HOUR = 8, HOUR_OF_DAY = 8, MINUTE = 40, SECOND = 0, MILLISECOND = 584, ZONE_OFFSET = -10800000, DST_OFFSET = 0]
Note the following values:
YEAR: 2017 (OK)
MONTH: 1 (OK - Starts at 0, so we're talking about February)
DAY_OF_YEAR: 33 (OK - since we have the 2nd of February)
DAY_OF_WEEK: 2 (WRONG, it should be 5)
The following lines have been executed:
Calendar data = Calendar.getInstance();
data.set(0, 0, 0, 0, 0, 0);
data.setTime(arrAAM.get(i).getRegistroAulaAvulsa().getDataInicio());
Note: I have tried in milliseconds (% with%).