I need to randomly split the data in a 2 dimensional array. The data is being read from a txt file. The data must be split 75% and 25%. After the split I need to calculate the euclidean distance.
1
Expert's answer
2015-09-29T05:22:44-0400
import java.io.*; import java.util.Scanner; public class Question { public static void main(String args[ ]) throws IOException { int i = 0; Scanner sc = new Scanner(new File("C://file.txt")); float []c = new float[10000]; while( sc.hasNext()){ c[i]=sc.nextFloat(); i ++; }
int a =(int)(i*0.75); System.out.println("a="+a); int b = i-a; System.out.println("b="+b); int a1=a; int b1 =b; float [][]mas = new float[10000][2];
Comments
Leave a comment