public void CosineSimilarity( ArrayList<Integer> h) throws Exception {
int[] vec1 = h.stream().mapToInt(t -> t).toArray();
String sql="Select Budget,Day from menu ;
DatabaseConnection db = new DatabaseConnection();
Connection conn =db.getConnection();
PreparedStatement ps = conn.prepareStatement(sql);
ArrayList<String> vector=new ArrayList<String>();
vector.add("Budget");
vector.add("Day");
ResultSet rs = ps.executeQuery();
ArrayList<Double> value = new ArrayList<Double>();
while (rs.next())
{
ArrayList<Integer> r=new ArrayList<Integer>();
r.add(rs.getInt("Budget"));
r.add(rs.getInt("Day"));
int vec2[] = r.stream().mapToInt(t -> t).toArray();
double cos_sim=cosine_similarity(vec1,vec2);
value.add(cos_sim);
}
pick_highest_value_here_and_display(value);
ps.close();
rs.close();
conn.close();
}