import java.io.*;
public class FileIn {
public static void main(String [] args){
System.out.println("程序在运行!");
long startTime=System.currentTimeMillis();
FileIn f=new FileIn();
f.file();
long endTime=System.currentTimeMillis();
System.out.println("运行时间:"+(endTime-startTime)+"毫秒");
}
public void file(){
try{
FileInputStream fis=new FileInputStream("largeW.txt");
InputStreamReader dis=new InputStreamReader(fis);
BufferedReader reader=new BufferedReader(dis);
String s;
int num=0;
long a[];
int j=0;
a=new long[1000000];
while((s=reader.readLine())!=null){
num++;
a[j]=Long.decode(s);
j++;
}
FileIn sort=new FileIn();
sort.bubblesort(a);
// sort.printl(a);
dis.close();
}catch(IOException e){
System.out.println(e);
}
}
public void printl(long[] a){
for(int i=0;i<a.length;i++){
System.out.println(a[i]);
}
}
public void bubblesort(long [] a){
int i,j;
long temp;
boolean flag;
for(i=0,flag=true;i<a.length-1&&flag;i++){
flag=false;
for(j=0;j<a.length-1-i;j++){
if(a[j]>a[j+1]){
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
flag=true;
}
}
}
}
}
public class FileIn {
public static void main(String [] args){
System.out.println("程序在运行!");
long startTime=System.currentTimeMillis();
FileIn f=new FileIn();
f.file();
long endTime=System.currentTimeMillis();
System.out.println("运行时间:"+(endTime-startTime)+"毫秒");
}
public void file(){
try{
FileInputStream fis=new FileInputStream("largeW.txt");
InputStreamReader dis=new InputStreamReader(fis);
BufferedReader reader=new BufferedReader(dis);
String s;
int num=0;
long a[];
int j=0;
a=new long[1000000];
while((s=reader.readLine())!=null){
num++;
a[j]=Long.decode(s);
j++;
}
FileIn sort=new FileIn();
sort.bubblesort(a);
// sort.printl(a);
dis.close();
}catch(IOException e){
System.out.println(e);
}
}
public void printl(long[] a){
for(int i=0;i<a.length;i++){
System.out.println(a[i]);
}
}
public void bubblesort(long [] a){
int i,j;
long temp;
boolean flag;
for(i=0,flag=true;i<a.length-1&&flag;i++){
flag=false;
for(j=0;j<a.length-1-i;j++){
if(a[j]>a[j+1]){
temp=a[j];
a[j]=a[j+1];
a[j+1]=temp;
flag=true;
}
}
}
}
}