import java.util.*;
import java.text.*;
public class Main {
String dataFormatada
= formato.
format(data
);
calendario.setTime(data);
int dia
= calendario.
get(Calendar.
DAY_OF_MONTH);
System.
out.
println(getDiaPorExtenso
(dia
) + dataFormatada
); }
String dias
[] = {"zero",
"um",
"dois",
"três",
"quatro",
"cinco",
"seis",
"sete",
"oito",
"nove"};
if (dia < 1 || dia > 31) {
throw new Exception("Não existe esse dia em nenhum mês do ano"); }
else if (dia < 10) {
retorno = dias[dia];
}
else if (dia < 20) {
"dez", "onze", "doze", "treze", "quatorze", "quinze", "dezesseis", "dezessete", "dezoito", "dezenove"
}[dia - 10];
}
else if (dia < 30) {
if (dia == 20) {
retorno = "vinte";
}
else {
retorno = "vinte e " + dias[dia - 20];
}
}
else {
if (dia == 30) {
retorno = "trinta";
}
else {
retorno = "trinta e " + dias[dia - 30];
}
}
// Capitaliza apenas a primeira letra do dia.
return retorno.substring(0, 1).toUpperCase() + retorno.substring(1);
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS50ZXh0Lio7CgpwdWJsaWMgY2xhc3MgTWFpbiB7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmdbXSBhcmdzKSB0aHJvd3MgRXhjZXB0aW9uIHsKCQlEYXRlIGRhdGEgPSBuZXcgR3JlZ29yaWFuQ2FsZW5kYXIoMjAxNCwgQ2FsZW5kYXIuRkVCUlVBUlksIDExKS5nZXRUaW1lKCk7CgkJTG9jYWxlIGxvY2FsID0gbmV3IExvY2FsZSgicHQiLCJCUiIpOwoJCURhdGVGb3JtYXQgZm9ybWF0byA9IG5ldyBTaW1wbGVEYXRlRm9ybWF0KCIgJ2RlJyBNTU1NICdkZScgeXl5eSIsbG9jYWwpOwoJCVN0cmluZyBkYXRhRm9ybWF0YWRhID0gZm9ybWF0by5mb3JtYXQoZGF0YSk7CgkJCgkJQ2FsZW5kYXIgY2FsZW5kYXJpbyA9IENhbGVuZGFyLmdldEluc3RhbmNlKCk7CgkJY2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