Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import com.company.ArrayUtils;
- import com.company.SwingUtils;
- import java.util.Locale;
- import java.util.Scanner;
- public class Program {
- public static void main(String[] args) throws Exception {
- //SwingUtils.setLookAndFeelByName("Windows");
- if (args.length == 0) {
- Locale.setDefault(Locale.ROOT);
- //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- SwingUtils.setDefaultFont("Times New Roman", 16);
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(() -> new FrameMain().setVisible(true));
- }
- else {int[][] matrix = ArrayUtils.readIntArray2FromFile(args[0]);
- String[][] arr2;
- arr2 = Task.solution(matrix);
- String fileName;
- if (args.length==1) {
- System.out.print("Print file name to save: ");
- Scanner scn = new Scanner(System.in);
- fileName = scn.nextLine();
- if (!fileName.toLowerCase().endsWith(".txt")) {
- fileName += ".txt";
- }
- ArrayUtils.writeArrayToFile(fileName, arr2);
- }
- if (args.length == 2) {
- if (!args[1].endsWith(".txt")) {
- args[1] += ".txt";
- }
- ArrayUtils.writeArrayToFile(args[1], (arr2));}
- else System.err.print(-1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement