String tempo = Métodos.getStringTempo();
int tempoSemLetra = Integer.valueOf(tempo.replace("s", "").replace("m", "")
.replace("h", "").replace("d", ""));
long added = 0L; //não sei porque precisa de long
if (tempo.endsWith("s")) {
added = tempoSemLetra * 1000;
} else if (tempo.endsWith("m")) {
added = tempoSemLetra * 60 * 1000;
} else if (tempo.endsWith("m")) {
added = tempoSemLetra * 60 * 60 * 1000;
else if (tempo.endsWith("d")) {
added = tempoSemLetra * 24 * 60 * 60 * 1000;
}
Timestamp timestamp = new Timestamp(System.currentTimeMillis() + added);
You do not convert a time period to a point in time, which is to take a point in time (the timestamp ) and add an amount of thousandths according to the < in> string displayed. This is the right concept.
I added time too, it's not in the question, but it does not make sense not to. If it is not to have, just take that part. If you have other units, how do month and year do. I did not do it, because it's in the title, but it's not in the body of the question. I would have to see what the letter used for the month would be to avoid conflicting with the minute. And decide what the time will be, because it depends on each month. For the year has the complication of the leap year.
I emphasize that this is a naive implementation and everything has to be correct to work. It may have other requirements, but the question does not make anything clear about this.
Because I do not have a bigger context of the problem I can not say much, but it seems to me that there may be a better solution.