⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filei.java

📁 这是一个判断闰年的JAVA源代码程序
💻 JAVA
字号:

import java.io.*;
public class fileioput{
   public static void main(String args[]) throws
FileNotFoundException,IOException{
        String s;
        FileInputStream is;
        InputStreamReader ir;
        BufferedReader in;
        int temp = 0,readfile = 0,i = 0,j = 0,a[] = new int[11],l = a.length;
        byte c;
        is = new FileInputStream("SrcFile.txt");
        readfile = is.read();
        while(readfile != -1){                         //读取文件
             c = (byte)readfile;
                  if(c >= '0' && c <= '9'){
                      temp = temp*10+c-48;  
                }
                  else {
                        a[i] = temp;                  //赋值给一维数组
                        temp = 0;
                        i ++;
                       }          
                readfile = is.read();  
        }
               a[i] = temp;
      
            /*  排序  */
             for(i = 0;i < l;i ++)
                for(j = i + 1;j < l;j ++)
                   if(a[i] < a[j]){
            	        int t = a[i];
            	        a[i] = a[j];
            	        a[j] = t;
            	}
            	
            	
        FileOutputStream out = new FileOutputStream ("DesFile.txt");    //输出文件
	DataOutputStream out1 = new DataOutputStream (out);
	StringBuffer str = new StringBuffer("");
	for (i = 0;i < 11;i ++){
		str.append(a[i]).append(" ");
	}
	String ss = new String(str);
	out1.writeBytes(ss);
  }
}
  
               
                     

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -