37 lines
844 B
Java
37 lines
844 B
Java
import javax.swing.*;
|
|
import java.awt.*;
|
|
import java.io.*;
|
|
import javax.swing.filechooser.FileNameExtensionFilter;
|
|
|
|
public class Register{
|
|
public static void sauvegarde(String name, int [][] g){
|
|
int val[] = new int[9];
|
|
|
|
int actuVal=0;
|
|
int v=0;
|
|
|
|
try{
|
|
FileOutputStream fichier = new FileOutputStream(name);
|
|
DataOutputStream flux = new DataOutputStream(fichier);
|
|
|
|
try{
|
|
|
|
|
|
for(int i=0; i<9; i++){
|
|
for(int j=0; j<9; j++){
|
|
actuVal = g[i][j];
|
|
v = (v*10) - actuVal;
|
|
}
|
|
flux.writeInt(-v);
|
|
v=0;
|
|
actuVal=0;
|
|
}
|
|
flux.close();
|
|
}catch(IOException e){
|
|
System.out.println("Lecture fichier imposible");
|
|
}
|
|
}catch(FileNotFoundException e){
|
|
System.out.println("Fichier non trouvé");
|
|
}
|
|
}
|
|
} |