<<Easy Learning Data Structures & Algorithms Java Practice >> good for you

en.verejava.com
package com.tool.util;
import java.util.Arrays;
public class Numbers {
private int[] numbers = { 87, 32, 29, 13, 6, 45, 32, 17 };
public boolean isSet() {
for (int i = 0; i < numbers.length; i++) {
for (int j = 0; j < numbers.length; j++) {
if (i != j && numbers[i] == numbers[j])
return false;
}
}
return true;
}
public boolean contains(int num) {
return Arrays.binarySearch(numbers, num) > -1;
}
public void sort() {
Arrays.sort(numbers);
}
public void print()
{
for(int i=0;i<numbers.length;i++)
{
System.out.print(numbers[i]+", ");
}
}
public static void main(String[] args) {
Numbers numbers=new Numbers();
numbers.sort();
numbers.print();
}
}