Сравнение строк всегда false, хотя строки одинаковы
package com.javarush.task.task32.task3210;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
/*
Используем RandomAccessFile
*/
public class Solution {
public static void main(String... args) throws IOException {
RandomAccessFile randomAccessFile = new RandomAccessFile(args[0], "rw");
int number = Integer.parseInt(args[1]);
String text = args[2];
int length = text.length();
randomAccessFile.seek(number);
byte[] array = new byte[args[0].length()];
randomAccessFile.read(array, 0, length);
int lengthOfFile = args[0].length();
String st = new String(array, StandardCharsets.UTF_8);
randomAccessFile.seek(lengthOfFile);
if (text.equals(st)) {
randomAccessFile.write("true".getBytes());
}
else {
randomAccessFile.write("false".getBytes());
}
}
}