import java.io.*;
import java.util.*;
import java.text.*;
//--------------------------------------------------------------------------------------------------------------------------------------------------
public class KateAug17{
private static StringBuffer buffer;
private static BufferedReader input1=null;
public static String [] arrayM1 = new String [10000];
public static Double [][] coordinates1 = new Double [10000][4];
public static Double [][] coordinates2 = new Double [10000][10];
public static String [] arrayM2 = new String [10000];
public static Double [][] coordinatesDiff = new Double [100][100];
public static Double [] Translate = new Double [10];
static DecimalFormat fmt= new DecimalFormat("0.000"); //3 D.P
//main method
public static void main(String args[]) {
int rows=0;
int i = 0;
int j = 0;
double x=0;
double y=0;
double z=0;
String text1;
String text2;
int n=0;
try{
FileInputStream fstream1 = new FileInputStream("D:\\project1\\exp\\proteins\\1A6G.pdb.txt");
FileInputStream fstream2 = new FileInputStream("D:\\project1\\exp\\proteins\\1A6K.pdb.txt");
DataInputStream in1 = new DataInputStream(fstream1); // Get the object of DataInputStream
DataInputStream in2 = new DataInputStream(fstream2); // Get the object of DataInputStream
BufferedReader br1 = new BufferedReader(new InputStreamReader(in1));
BufferedReader br2 = new BufferedReader(new InputStreamReader(in2));
while ((text1 = br1.readLine()) != null) { //Read File Line By Line
if(text1.trim().startsWith("ATOM")) {
StringTokenizer s1 = new StringTokenizer(text1," ");
int counter1=0;
String line1="";
while(s1.hasMoreTokens()) {
String ss1 = s1.nextToken();
counter1++;
if(counter1 == 3){
line1 += ss1;
arrayM1[rows] = ss1;
}
}
coordinates1[rows][0]= Double.parseDouble(text1.substring(30,38));//X
coordinates1[rows][1]= Double.parseDouble(text1.substring(38,46));//Y
coordinates1[rows][2]= Double.parseDouble(text1.substring(46,56));//Z
rows+=1;
}//end of if
} //end of while.
rows=0;
while ((text2 = br2.readLine()) != null) { //Read File Line By Line
if(text2.trim().startsWith("ATOM")) {
StringTokenizer s2 = new StringTokenizer(text2," ");
int counter2=0;
String line2="";
while(s2.hasMoreTokens()) {
String ss2 = s2.nextToken();
counter2++;
if(counter2 == 3){
line2 += ss2;
arrayM2[rows] = ss2;
}
}
coordinates2[rows][0]= Double.parseDouble(text2.substring(30,38));//X
coordinates2[rows][1]= Double.parseDouble(text2.substring(38,46));//Y
coordinates2[rows][2]= Double.parseDouble(text2.substring(46,56));//Z
rows+=1;
}//end of if
} //end of while.
}//end of try
catch( IOException e) {
e.printStackTrace();
}//end of catch
//------------------------------------------------------END OF 2D ARRAY--------------------------------------------------------------------------------
//System.out.println(coordinates2[i][0]+"\t"+coordinates2[i][1]+"\t"+coordinates2[i][2]);
for(i=0; i<rows; i++){
//for(int k=0; k<4; k++){
if((arrayM1[1].equals("CA"))&&(arrayM2[1].equals("CA"))){
//Difference
coordinatesDiff[0][0] = coordinates1[1][0]/coordinates2[1][0];
coordinatesDiff[0][1] = coordinates1[1][1]/coordinates2[1][1];
coordinatesDiff[0][2] = coordinates1[1][2]/coordinates2[1][2];
System.out.println(coordinates1[i][0]);
//double [][] Translation1={ {x,0,0}, {0,y,0}, {0,0,z} };
// coordinates1[i][j] = coordinates2[i][k]*Translation1[k][j];
// }
}
}
//System.out.println(coordinates2[1][0]+"\t"+coordinates2[1][1]+"\t"+coordinates2[1][2]);
//System.out.println("\t"+fmt.format(coordinates2[1][0])+"\t"+fmt.format(coordinates2[1][1])+"\t"+fmt.format(coordinates2[1][2])+"\t");
//System.out.println(Translate[i]);
}//end of main
}//end of class
How do I get my coordinates1[j] & coordinates? I need the whole full array. It's a i x 3 array. When I print the above, I get weird values. I didn't get the original value.