程序计时,读取二维数组
作者:互联网
java程序计时
long startTime=System.currentTimeMillis(); /** *代码块 */ long endTime = System.currentTimeMillis(); System.out.println("程序的执行时间:" + (endTime - startTime));
依次读取文件中二维数组:
FileInputStream fileInputStream = null; try { fileInputStream = new FileInputStream("src\\o_athletes\\test\\pref0.in"); } catch (FileNotFoundException e) { e.printStackTrace(); } Scanner scanner =new Scanner(fileInputStream); int n=scanner.nextInt(); System.out.println(n); int[][] a=new int[n][n]; int[][] q=new int[n][n]; for (int i = 0; i <n; i++) { for (int j = 0; j < n; j++) { a[i][j]=scanner.nextInt(); System.out.println(a[i][j]); } } System.out.println("_____"); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { q[i][j]=scanner.nextInt(); System.out.println(q[i][j]); } }
标签:读取,int,FileInputStream,System,fileInputStream,二维,计时,new,scanner 来源: https://www.cnblogs.com/lyl890/p/16327215.html