SHARE
TWEET

Untitled

a guest May 25th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class Date implements Comparable<Date>{
  2.     int month;
  3.     int day;
  4.     int year;
  5.     public Date(int m, int d, int y){
  6.         this.month = m;
  7.         this.day = d;
  8.         this.year = y;
  9.     }
  10.  
  11.     @Override
  12.     public int compareTo(Date o) {
  13.         int yDelta = this.year - o.year;
  14.         int mDelta = this.month - o.month;
  15.         int dDelta = this.day - o.day;
  16.         return ((yDelta * 365) + (mDelta * 31) + dDelta);
  17.     }
  18. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top