/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
{
System.
out.
println(diasDifferencia
("02/01/2002",
"01/04/2002")); }
public static double diasDifferencia
(String fechaInit,
String fechaEnd
){
String[] dateInit
= fechaInit.
split("/"); String[] dateEnd
= fechaEnd.
split("/");
dEndLocale.
set(Integer.
parseInt(dateEnd
[2]),
Integer.
parseInt(dateEnd
[1])-1,
Integer.
parseInt(dateEnd
[0]));dInitLocale.
set(Integer.
parseInt(dateInit
[2]),
Integer.
parseInt(dateInit
[1])-1,
Integer.
parseInt(dateInit
[0]));
System.
out.
println((dEndLocale.
getTime().
getTime() - dInitLocale.
getTime().
getTime())/(1000 * 60 * 60 * 24.0)); System.
out.
println((dEndLocale.
getTime().
getTime() - dInit.
getTime())/(1000 * 60 * 60 * 24.0)); double diff = (dEnd.getTime() - dInit.getTime())/(1000 * 60 * 60 * 24.0);
return diff;
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVN5c3RlbS5vdXQucHJpbnRsbihkaWFzRGlmZmVyZW5jaWEoIjAyLzAxLzIwMDIiLCIwMS8wNC8yMDAyIikpOwoJfQoJCglwdWJsaWMgc3RhdGljIGRvdWJsZSBkaWFzRGlmZmVyZW5jaWEoU3RyaW5nIGZlY2hhSW5pdCwgU3RyaW5nIGZlY2hh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