Help me
package com.javarush.task.task18.task1827;
/*
Прайсы
*/
import java.io.*;
import static java.lang.StrictMath.max;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String fileName = reader.readLine();
reader.close();
if(args.length > 0 && args[0].equals("-c")) {
BufferedReader inStream = new BufferedReader(new FileReader(fileName));
int d;
int max = 0;
while(inStream.ready()) {
d = Integer.parseInt(inStream.readLine().substring(0, 8).trim());
max = max(max, d);
max = max + 1;
}
inStream.close();
BufferedWriter outStream = new BufferedWriter(new FileWriter(fileName, true));
String id = String.valueOf(max);
String productName = args[1];
String price = args[2];
String quantity = args[3];
while(id.length() < 8) {
id = id + " ";
}
while(productName.length() < 30) {
productName = productName + " ";
}
while(price.length() < 8) {
price = price + " ";
}
while(quantity.length() < 4) {
quantity = quantity + " ";
}
outStream.write(System.lineSeparator() + id.substring(0, 8) + productName.substring(0, 30) + price.substring(0, 8) + quantity.substring(0, 4));
outStream.close();
}
}
}