Hey Priya,
Think that that could be more a Java question, then a Mendix one ;-) Might I suggest you use a Mendix function in your Microflow for datetime comparisons? E.g. daysBetween(a, b). You can use this function, e.g. when creating a variable in a microflow. You can find the documentation on these functions right here: https://docs.mendix.com/refguide/between-date-function-calls. It would be possible to return this time difference in your java action as a parameter of the JA call.
Alternatively, if you need Java: https://stackoverflow.com/questions/55779996/calculate-days-hours-and-minutes-between-two-instants this post seems to give enough options to try.
Best regards,
Wouter
You can do this in a microflow with yearsBetween, daysBetween and some logic.
If a Java-action is not needed, don't use it. It is harder to maintain, not all Mendix Developers understand it and bugs are harder to find and fix.
You can use the above code instead of start date and end date give received date and processed date