title: how to find Elements from array which makes sum equals to given value
body: <p>the lowest number of integers in the array that sums up the given number. The program should ask a user to input array of integers (“Input Array”) and the required sum (“Required Sum”). The output (“Output”) should list the lowest number of integers from the input array that sums up the “Required Sum”.  Refer to examples given below.</p>
  
  <p>Example:</p>
  
  <p>Input Array : [10, 0, -1, 20, 25, 30]
  Required Sum: 45
  Output: [20, 25]</p>
  
  <p>Required Sum: 59
  Output: [10, -1, 20, 30]</p>
  
  <p>Required Sum: 60
  Output: [10, 20, 30]</p>
  
  <p>public static void main(String[] args) {</p>
  
  <pre><code>                int arr[]={10, 0, -1, 20, 25, 30};
  
                  int sum=59 ,temp=0;
  
                  for(int i=0;i&lt;arr.length;i++){
  
                      for(int j=i;j&lt;arr.length;j++){
  
  
                      if(arr[i]&gt;arr[j]){
  
                          temp=arr[i];
                          arr[i]=arr[j];
                          arr[j]=temp;
  
                      }
                    }
                  }
  
                  for(int i=0;i&lt;arr.length;i++){
                      System.out.println(arr[i]);
                    }
  
                for(int i=0;i&lt;arr.length;i++){
  
                      for(int j=i;j&lt;arr.length-1;j++){
  
                          if(arr[i]+arr[j]==sum){
  
                              System.out.println(arr[i]+","+arr[j]);
  
                              break;
                               }
  
  
                          else {
                              for(int k=j+1;k&lt;arr.length-2;k++){
  
                                  if(arr[i]+arr[j]+arr[k]==sum){
  
                                      System.out.println(arr[i]+","+arr[j]+","+arr[k]);
  
                                      break;
                                  }
                              }
                          }
  
                       }
  
                    }         
  </code></pre>