не проходит по 3 пункту. не могу решить
package com.javarush.task.task18.task1827;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
/*
Прайсы
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String s = reader.readLine();
FileReader fileReader = new FileReader(s);
FileWriter fileWriter = new FileWriter(s, true);
String table = "";
int maxId = 0;
// String [] crud = {"-c" ,"Pantss для сноубистов, разм", "10173.99", "1234"};
if (args[1] != null && args[2] != null && args[3] != null &&
!args[1].trim().equals("") && !args[2].trim().equals("") && !args[3].trim().equals("")) {
if(args[0] == "-c") {
int byt;
while((byt = fileReader.read()) != -1) {
table += (char)byt;
}
maxId = maxId(table) + 1;
String newLine = "\n" + (returnMaxId(maxId)) + returnName(args[1]) + returnPrice(args[2]) + returnCount(args[3]);
fileWriter.write(newLine);
}
}
reader.close();
fileReader.close();
fileWriter.close();
}
static String returnMaxId(int id) {
String str = Integer.toString(id);
while(str.length() < 8) {
str += " ";
}
return str;
}
static String returnName(String str) {
while(str.length() < 30) {
str += " ";
}
return str;
}
static String returnPrice(String str) {
while(str.length() < 8) {
str += " ";
}
return str;
}
static String returnCount(String str) {
while(str.length() < 4) {
str += " ";
}
return str;
}
static int maxId(String lines) {
String [] list = lines.split("\n");
int maxId = 0;
String num = "";
for(int i = 0; i < list.length; i++) {
String tmp = list[i].substring(0, 8);
char[] nums = tmp.toCharArray();
for(char c : nums) {
if(Character.isDigit(c)) {
num += c;
}
}
Integer idLine = Integer.parseInt(num);
if(maxId < idLine) {
maxId = idLine;
}
num = "";
}
return maxId;
}
}