public static DataEntry[] getKNearestNeighbours(List<DataEntry> dataSet, final double[] x, int k){
		Comparator<DataEntry> distanceComparator = new Comparator<DataEntry>(){
			@Override
			public int compare(DataEntry arg0, DataEntry arg1) {
				double distA = distance(arg0.getX(), x);
				double distB = distance(arg1.getX(), x);
				if(distA < distB) return 1;
				else if(distA == distB) return 0;
				return -1;
			}
		};
		PriorityQueue<DataEntry> pe = new PriorityQueue<DataEntry>(k, distanceComparator);
		double fjernest = Double.MIN_VALUE;
		int i = 0;
		for(DataEntry tse : dataSet){
			if(i < k){ //Not full
				pe.add(tse);
				fjernest = distance(pe.peek().getX(), x);
			}
			else{
				double distance = distance(x,tse.getX());
				if(distance < fjernest){
					pe.poll();
					pe.add(tse);
					fjernest = distance(pe.peek().getX(),x);
				}
			}
			i++;
		}
		DataEntry[] retur = new DataEntry[k];
		i = 0;
		for(DataEntry d : pe){
			retur[i] = d;
			i++;
		}
		return retur;
	}