title: How to achieve sort by value in spark java
body: <pre><code>JavaPairRDD&lt;String, Float&gt; counts = ones
              .reduceByKey(new Function2&lt;Float, Float, Float&gt;() {
                  @Override
                  public Float call(Float i1, Float i2) {
                      return i1 + i2;
                  }
              });
  </code></pre>
  
  <p>My output looks like this:</p>
  
  <pre><code>id,value
  100002,23.47
  100003,42.78
  200003,50.45
  190001,30.23
  </code></pre>
  
  <p>I would like the output to be sorted by value like:</p>
  
  <pre><code>200003,50.45
  100003,42.78
  190001,30.23
  100002,23.47
  </code></pre>
  
  <p>How do I achieve this?</p>