I have this code, comparator for sorting values:

```
public static Comparator<Partikel> getFFsorted() {
    Comparator comp = new Comparator<Partikel>() {
        @Override
        public int compare(Partikel s1, Partikel s2) {
            if(s1.ff>s2.ff)
            {
                return 1;
            }
            else
            {
                return -1;
            }
        }
    };
    return comp;
}

```

but I have an error like this :

> 
> Exception in thread "main" java.lang.IllegalArgumentException:
>  Comparison method violates its general contract! at
>  java.util.TimSort.mergeHi(TimSort.java:868)
> 
> 
> at java.util.TimSort.mergeAt(TimSort.java:485)
> 
> 
> at java.util.TimSort.mergeCollapse(TimSort.java:410)
> 
> 
> at java.util.TimSort.sort(TimSort.java:214)
> 
> 
> at java.util.TimSort.sort(TimSort.java:173) 
> 
> 
> at java.util.Arrays.sort(Arrays.java:659)
> 
> 
> at java.util.Collections.sort(Collections.java:217)
> 
> 
> 

How do I fix it?