this is my code
package arryofpackage;
public class UnqueElement {
public static int findUnique(int[] arr)
{
for(int i=0;i<arr.length;i++)
{
int j;
for(j=0;i<arr.length;i++)
{
if(i!=j)
{
if(arr[i]==arr[j])
{
break;
}
}
}
if(j==arr.length)
{
return arr[i];
}
}
return Integer.MAX_VALUE;
}
public static void main(String[] args)
{
int arr[]= {2,3,3,4,5};
int unique=findUnique(arr);
System.out.println(unique);
}
}
can you tell me is it good to print like this bcz im having a garbage output like this =>2147483647