Find The Duplicates in two arrays
Here are my comments:


The variable k was probably meant to keep track of size of the array list (number of duplicates).  However, it is redundant, since you use the list's size() method. 
To convert a list to array you can use the stream API. while I am not certain if it provides any time/space benefits, it is probably the most optimized way to do it, and it saves you having to declare the return array. Since it is tricky to do the conversion with primitive types arrays, here it is: ans.stream().mapToInt(item -&gt; item.intValue()).toArray(); and you can make it the return value of the method.
The while condition is using redundant parentheses that have the &amp;&amp; between them . It can be argued as a matter of taste, but in my eyes, the condition is clearer without them. I add an additional space around the higher order operator: while(i &lt; arr1.length  &amp;&amp;  j &lt; arr2.length)