title: Replacing Negatives integers in array with zero and making another array to store the numbers excluding all the zeroes
body: <p>The type of input should be like <code>1, -9 ,6, -7, -4, 3</code>
  and there should be 2 outputs. First one <code>1 0 6 0 0 3</code>
  and second one <code>1 6 3</code>:</p>
  
  <pre><code>import java.util.*;
  
  class pr9 {
      public static void calc() {
          Scanner sc=new Scanner(System.in);
          int x,i;
          System.out.println("Enter Length of the Array");
          x=sc.nextInt();
          int a[]=new int[x];
          int b[]=new int [x];
          for(i=0;i&lt;x;i++) {
              System.out.println("Enter " +x+" Numbers");
              a[i]=sc.nextInt();
          }
          for(i=0;i&lt;x;i++) {
              if(a[i]&lt;0) {
                  a[i]=0;
              }
              System.out.print(a[i]+" ");
  
          }
          for(i=0;i&lt;x;i++) {
              if(a[i]!=0) {
                  a[i]=b[i];
              }
              System.out.print(b[i]);
          }
  
  
          }
      }
  }
  </code></pre>
  
  <p>This is how I did it but still in the second array where the zeroes should be eliminated , all are appearing zero.</p>