java.util.Date d = new java.util.Date();
java.text.SimpleDateFormat f = new java.text.SimpleDateFormat("y");
java.text.SimpleDateFormat q = new java.text.SimpleDateFormat("mm");
java.util.Date a = new java.util.Date();

int yearnow = Integer.parseInt(f.format(d));
int mouthnow = Integer.parseInt(q.format(d));
int usermouth=Integer.parseInt(q.format(userdate.getDate()));
int birthnow = Integer.parseInt(f.format(userdate.getDate()));
int all = yearnow - birthnow;
int all2 = mouthnow - usermouth;

JOptionPane.showMessageDialog(null, all + "year"+ " "+"mouth "+all2);
it do not calculate mouth and day right can i can calculate mouth and day in right way can any one help me cause mouth - mouth = not right answer and day - day = not right answer and year - year = not right answer(may be me have one mouth and it will be year case 2016- 2017=1 i hope any one help me