code: public static int getLastDayOfMonth(Date date) {
          Calendar c = Calendar.getInstance();
          c.setTime(date);
          return c.getActualMaximum(Calendar.DATE);
      }
docs: Get last day from a month
  @param date date
  @return last day from a month