Remove duplicates from integer array

前端 未结 23 2415
执念已碎
执念已碎 2020-12-01 18:52

I having a problem with coding this:

Write a static method named removeDuplicates that takes as input an array of integers and returns as a result a new

23条回答
  •  天涯浪人
    2020-12-01 19:15

    public class Test 
    static int[] array = {4, 3, 3, 4, 5, 2, 4};
    static HashSet list = new HashSet();
    public static void main(String ar[])
    {       
        for(int i=0;i

    The Output is : [2, 3, 4, 5]

提交回复
热议问题