private void pick_highest_value_here_and_display( ArrayList<Double> value,int b,int k) throws Exception { // TODO Auto-generated method stub double aa[]=value.stream().mapToDouble(v -> v.doubleValue()).toArray(); double highest=Double.MIN_VALUE; double secHighest=Double.MIN_VALUE; int highestIndex=0; int secIndex=0; for(int i=0;i<aa.length;i++) { if(aa[i]>highest) { secHighest=highest; highest=aa[i]; highestIndex=i; } } System.out.println("The highest value is "+highest+""); System.out.println("It is found at index "+highestIndex+""); String sql ="Select Budget and Day from menu where ID =?"; DatabaseConnection db = new DatabaseConnection(); Connection conn =db.getConnection(); PreparedStatement ps = conn.prepareStatement(sql); ps.setInt(1, highestIndex); ResultSet rs = ps.executeQuery(); if (rs.next()) { int ba=rs.getInt("Budget"); int aaa=rs.getInt("Day"); System.out.println("The budget categorizes in sql is"+ba); System.out.println("Day in sql is"+aaa); }
String sql ="Select Budget and Day from menu where ID =?";
String sql ="Select Budget, Day from menu where ID =?";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)