nbsp; finishMsg += \" (\" + jsFileList.size() + \" file(s) formatted)\";
}
} catch (Exception e) {
e.printStackTrace();
return;
}
// Finish message
System.out.println(finishMsg);
}
/**
* Format a JS file.
*
* @param fileName The file name of the file which is to be formatted.
* @return String The formatted string.
* @throws IOException Exception when open, read and write file.
*/ [Page]
private static void formatFile(String fileName) throws IOException {
String formattedFileName = fileName + \".formatted\";
FileReader fr = new FileReader(fileName);
FileWriter fw = new FileWriter(formattedFileName);
String lastWord = \"\";
int forCount = 0;
int quoteCount = 0;
int sigleQuoteCount = 0;
int bracketCount = 0;
int thisChar = 0;
int lastChar = 0;
int nextChar = 0;
thisChar = fr.read();
if(thisChar != -1) {