Removing duplicates from array in java can't use hashset
<p>Currently I am having trouble with removing duplicates from a given array. I have written a program, but it just returns all zeros. I cannot use a hashset. </p>

<pre><code>public class Assignment05a 
{
    public static void main(String args[]) 
    {
         int[] sourceArray = {1,4,5,4,1,2,3,5,9,7,12,-5,1,4,-1,-5,12,1};
         java.util.Arrays.sort(sourceArray);
         eliminateDuplicates(sourceArray); 
    }

    public static int[] eliminateDuplicates(int[] list)
    {   
         int[] noDup = new int[list.length]; 

         for (int c = 0; c &lt; list.length-1; c++)
         {
             if (list[c] != list[c+1])
                {
                    list[c] = noDup[c];
                }
         }

         for(int i = 0; i &lt; noDup.length; i++)
         {
             System.out.println(noDup[i]);
         }
         return noDup;
}   
}
</code></pre>
