Per concatenare le stringhe si usa l'opreratore +
basta fare
codice:
linea=linea.substring(0, linea.length()-1)+"1";