Advertisement
Guest User

mode

a guest
May 4th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. public Long getMode() {
  2. if(this.mode == null) {
  3. long value = 0;
  4.  
  5. for (long i = this.minimum; i <= this.maximum + 1; i++) {
  6. if (getFrequency(i) < getFrequency(i+1)) {
  7. value = i+1;
  8. }
  9. if (getFrequency(i) > getFrequency(i+1)) {
  10. value = value;
  11. }
  12. if (getFrequency(i) == getFrequency(i+1)) {
  13. value = -1;
  14. }
  15. }
  16. this.mode = value;
  17. }
  18. return this.mode;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement