Here is some sample code from iOS:
NSDate *startDateX = [NSDate date];
// Do a bunch of stuff
NSLog(@"Time difference: %f", -[startDateX timeIntervalSinceNow]);
The output looks like this:
Time difference: 15.009682
What is the equivalent way to do this in Android/Java?