I have a program that loads lines from a user file, then selects the last part of the String (which would be an int)

Here's the style it's saved in:

```
nameOfValue = 0
nameOfValue2 = 0

```

and so on. I have selected the value for sure - I debugged it by printing. I just can't seem to save it back in.

```
if(nameOfValue.equals(type)) {
        System.out.println(nameOfValue+" equals "+type);
            value.replace(value, Integer.toString(Integer.parseInt(value)+1));
        }

```

How would I resave it? I've tried bufferedwriter but it just erases everything in the file.