title: Java object: value for comparison in if statement, operator overloading
body: <p>Is it possible to define the value used for if statement comparison for custom objects?</p>
  
  <p>I have:</p>
  
  <p>public class element implements Comparable {</p>
  
  <pre><code>public int value;
  public int[] sequence;
  public int length;
  
  public element(){}   
  
  public element(int val){
      this.value = val;
  }
  
  @Override
  public int compareTo(Object o) {
      return
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I would like to use and if statement as follows:</p>
  
  <blockquote>
    <p>if (element1 > element2) ..</p>
  </blockquote>
  
  <p>Instead of a traditional:</p>
  
  <blockquote>
    <p>if (element1.value > element2.value) ..</p>
  </blockquote>
  
  <p>I have been unable to acomplish this with comparators, toString() etc</p>