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

📄 fileioutput.java

📁 这个JAVA程序很简单明了
💻 JAVA
字号:
import java.io.*;
public class FileIOutput{
   public static void main(String args[]) throws
FileNotFoundException,IOException{
        String s;
        FileInputStream is;
        InputStreamReader ir;
        BufferedReader in;
        int temp=0;
        int k=0;
        int i=0;
        int j=0;
        int a[]=new int[11];
        int l=a.length;
        byte c;
        is=new FileInputStream("SrcFile.txt");
        k= is.read();
        while(k!=-1){
             c=(byte)k;
                  if(c>='0'&&c<='9'){
                      temp = temp*10+c-48;  
                }
                  else {
                        a[i]=temp;
                        temp=0;
                        i++;
                       }          
                k=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 + -