title: finding odd or even from a array and inserting the value in to desired array. Not getting desired output
body: <pre><code>    public class Arr1{
      public static void main(String[]args){
          int a[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
          int even[]=new int[a.length];
          int odd[]=new int[a.length]; 
          for(int i=0;i&lt;a.length;i++){
              if(a[i]%2==0){
                  for(int j=0;j&lt;even.length;j++){
                      even[j]=a[i];
                  }
              }else{
                  for(int z=0;z&lt;odd.length;z++){
                      odd[z]=a[i];
                  }
              }
          }
          for(int j=0;j&lt;even.length;j++){
              System.out.print(even[j]+&quot; &quot;);          
          }System.out.println();
          for(int z=0;z&lt;odd.length;z++){
              System.out.print(odd[z]+&quot; &quot;);
          }    
      }
  }   
  </code></pre>
  <p>output:</p>
  <pre><code>20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 
  19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 19 
  </code></pre>