Hi all, my code fulfills the conditions and I've done multiple checks. Can't see where the mistake is, please help if you can. Thank you
package com.codegym.task.task32.task3201;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
/*
Writing to an existing file
*/
public class Solution {
public static void main(String... args) throws IOException {
String fileName = "C:/Users/teocl/OneDrive/Desktop/a.txt";
long number = 2;
long size = new File(fileName).length();
// System.out.println(size);
byte[] text = {55, 56, 55, 56, 55};
RandomAccessFile raf = new RandomAccessFile(fileName, "rw");
if (size < number) {
raf.seek(size);
raf.write(text);
} else {
raf.seek(number);
raf.write(text);
}
raf.close();
}
}