import java.util.Arrays;
import java.util.Date;
import java.util.TimeZone;
import java.text.ParseException;
import java.text.SimpleDateFormat;
class Datas {
public static void main
(String[] args
) { String[] array
= {"05/09/2016",
"10/10/2012",
"06/09/2016",
"5/4/2012",
"11/11/2016"}; ordenarDatas2(array);
}
sdf.
setTimeZone(TimeZone.
getTimeZone("UTC")); sdf.setLenient(false);
Date[] dates
= new Date[entrada.
length]; for (int i = 0; i < entrada.length; i++) {
try {
dates[i] = sdf.parse(entrada[i]);
}
}
for (int i = 0; i < entrada.length; i++) {
entrada[i] = sdf.format(dates[i]);
}
return entrada;
}
}
aW1wb3J0IGphdmEudXRpbC5BcnJheXM7CmltcG9ydCBqYXZhLnV0aWwuRGF0ZTsKaW1wb3J0IGphdmEudXRpbC5UaW1lWm9uZTsKaW1wb3J0IGphdmEudGV4dC5QYXJzZUV4Y2VwdGlvbjsKaW1wb3J0IGphdmEudGV4dC5TaW1wbGVEYXRlRm9ybWF0OwoKY2xhc3MgRGF0YXMgewogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4oU3RyaW5nW10gYXJncykgewogICAgICAgIFN0cmluZ1tdIGFycmF5ID0geyIwNS8wOS8yMDE2IiwgIjEwLzEwLzIwMTIiLCAiMDYvMDkvMjAxNiIsICI1LzQvMjAxMiIsICIxMS8xMS8yMDE2In07CiAgICAgICAgb3JkZW5hckRhdGFzMihhcnJheSk7CiAgICAgICAgU3lzdGVtLm91dC5wcmludGxuKEFycmF5cy50b1N0cmluZyhhcnJheSkpOwogICAgfQogICAgCiAgICBwdWJsaWMgc3RhdGljIFN0cmluZ1tdIG9yZGVuYXJEYXRhczIoU3RyaW5nW10gZW50cmFkYSkgewogICAgICAgIFNpbXBsZURhdGVGb3JtYXQgc2RmID0gbmV3IFNpbXBsZURhdGVGb3JtYXQoImRkL01NL3l5eXkiKTsKICAgICAgICBzZGYuc2V0VGltZVpvbmUoVGltZVpvbmUuZ2V0VGltZVpvbmUoIlVUQyIpKTsKICAgICAgICBzZGYuc2V0TGVuaWVudChmYWxzZSk7CiAgICAgICAgRGF0ZVtdIGRhdGVzID0gbmV3IERhdGVbZW50cmFkYS5sZW5ndGhdOwogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZW50cmFkYS5sZW5ndGg7IGkrKykgewogICAgICAgICAgICB0cnkgewogICAgICAgICAgICAgICAgZGF0ZXNbaV0gPSBzZGYucGFyc2UoZW50cmFkYVtpXSk7CiAgICAgICAgICAgIH0gY2F0Y2ggKFBhcnNlRXhjZXB0aW9uIGUpIHsKICAgICAgICAgICAgCXRocm93IG5ldyBJbGxlZ2FsQXJndW1lbnRFeGNlcHRpb24oZW50cmFkYVtpXSwgZSk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgQXJyYXlzLnNvcnQoZGF0ZXMpOwogICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgZW50cmFkYS5sZW5ndGg7IGkrKykgewogICAgICAgICAgICBlbnRyYWRhW2ldID0gc2RmLmZvcm1hdChkYXRlc1tpXSk7CiAgICAgICAgfQogICAgICAgIHJldHVybiBlbnRyYWRhOwogICAgfQp9