You can use the joda.time library which allows you to subtract times and get the result in seconds.

You would create two DateTime objects using a constructor that allows you to submit the time with int, like DateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, DateTimeZone zone).

As has been noted, you can do all this without joda time. In this case you would just use java.util.Date which has a method called getTime() which gives you the timestamp in milliseconds since 1970. If you get the timestamp from two java.util.Date objects (which are of the type long) and subtract them you get the milliseconds between those two dates. Devide this by 1000 to get seconds. Easy but not as Object Oriented as the joda time approach.