code: public static long getWeekEndTime(final long time) {
          final Calendar end = Calendar.getInstance();
          end.setFirstDayOfWeek(Calendar.MONDAY);
          end.setTimeInMillis(time);
          end.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
          end.set(Calendar.HOUR, 23);
          end.set(Calendar.MINUTE, 59);
          end.set(Calendar.SECOND, 59);
          end.set(Calendar.MILLISECOND, 999);
  
          return end.getTimeInMillis();
      }
docs: Gets the week end time with the specified time.
  
  @param time the specified time
  @return week end time