/* 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
{
{
/*
* Retorno que iremos trabalhar
*/
final String retorno
= "Sucesso! Usuario salvo. Id: 257";
// Pegamos a posição do : na String
int posicaoDoisPontos = retorno.indexOf(':');
// Caso ão ache os : na STring irá retornar -1
if(posicaoDoisPontos > -1){
// Vamos pegar a psoição a frente do : até o fim da String (seu tamanho)
String idLiteral
= retorno.
substring( (posicaoDoisPontos
+1) , retorno.
length() ); // Transformamos a String em Integer
}else{
System.
out.
println("Não foi possível formatar o valor!"); }
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwoKaW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgovKiBOYW1lIG9mIHRoZSBjbGFzcyBoYXMgdG8gYmUgIk1haW4iIG9ubHkgaWYgdGhlIGNsYXNzIGlzIHB1YmxpYy4gKi8KY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCQoJCS8qCgkJICogUmV0b3JubyBxdWUgaXJlbW9zIHRyYWJhbGhhciAKCQkgKi8KCQlmaW5hbCBTdHJpbmcgcmV0b3JubyA9ICJTdWNlc3NvISBVc3VhcmlvIHNhbHZvLiBJZDogMjU3IjsKCQkKCQkvLyBQZWdhbW9zIGEgcG9zacOnw6NvIGRvIDogbmEgU3RyaW5nCgkJaW50IHBvc2ljYW9Eb2lzUG9udG9zID0gcmV0b3Juby5pbmRleE9mKCc6Jyk7CgkJCgkJLy8gQ2FzbyDDo28gYWNoZSBvcyA6IG5hIFNUcmluZyBpcsOhIHJldG9ybmFyIC0xCgkJaWYocG9zaWNhb0RvaXNQb250b3MgPiAtMSl7C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