rendered paste bodyimport java.io.*;import java.lang.Math;public class Main{ static StreamTokenizer scanner; static int values = 2; static int n; static double[][] m; static double[][] matrix; protected static int readInt( ) throws IOException { scanner.nextToken( ); if ( scanner.ttype != StreamTokenizer.TT_NUMBER ) { System.err.println( scanner.lineno( ) + ": Int-Wert erwartet: " + scanner.toString() ); System.exit( 1 ); } return ( int )scanner.nval; } protected static double readDouble( ) throws IOException { scanner.nextToken( ); if ( scanner.ttype != StreamTokenizer.TT_NUMBER ) { System.err.println( scanner.lineno( ) + ": Double-Wert erwartet: " + scanner.toString() ); System.exit( 1 ); } return ( double )scanner.nval; } public static void main( String args[ ] ) { if ( args.length < 1 ) { System.out.println("Usage: java Matrix <filename>"); System.exit( 1 ); } String line; try { scanner = new StreamTokenizer( new BufferedReader( new FileReader( args[ 0 ] ) ) ); n = readInt( ); m = new double[ n+1 ][ values ]; for( int i = 0; i < n; i++ ) { for( int j = 0; j < values; j++) { m[ i ][ j ] = readDouble( ); } } for(int i=0; i<n; i++) { for(int j=0; j<2; j++) { System.out.println("matrix["+i+"]"+"["+j+"]"+m[i][j]); } } mathLength(); } catch ( FileNotFoundException e ) { System.err.println( "File " + args[ 0 ] + " not found" ); e.printStackTrace( ); System.exit( 1 ); } catch ( NumberFormatException e ) { System.err.println( "Value not convetable into int: " + e ); e.printStackTrace( ); System.exit( 1 ); } catch ( IOException e ) { System.err.println( "IO Error: " + e ); e.printStackTrace( ); System.exit( 1 ); } } public static void mathLength() { matrix = new double[n][n]; for(int x=0; x < n; n++ ) { for(int y=0; y < 1; y++) { double v = m[x][y]; double w = m[x][y+1]; for(int i=0; i < n; i++) { for(int j = 0; j < 1; j++) { double erg = Math.sqrt(Math.pow( (m[i][j] - v),2) - Math.pow( (m[i][j+1] - w),2)); matrix[x][i] = erg; } } } } for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { System.out.println("matrix: "+matrix[i][j]); } } }}