Java Number Sum sumLange(int _a, int _b)

Here you can find the source of sumLange(int _a, int _b)

Description

sum Lange

License

Open Source License

Declaration

public static int sumLange(int _a, int _b) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {

    public static int sumLange(int _a, int _b) {
        int a = _a;
        int b = _b;

        if (_a > _b) {
            b = _a;//w  ww .j a  v a 2  s .  co  m
            a = _b;
        }

        return (a + b) * (b - a + 1) / 2;
    }
}

Related

  1. sumHadOverflow(long a, long b, long sum)
  2. sumHash(int hash, String element)
  3. sumHash(int leftHash, int rightHash)
  4. sumIf(final Integer number, final Integer sum, final Boolean condition)
  5. sumIsMod10(int sum)
  6. sumLogProb(double a, double b)
  7. summarize(String longString, int limit)
  8. summarizeCigarString(String cigarString)
  9. summary(String text)