Examples of divide()


Examples of java.math.BigInteger.divide()

        if (values.size() == 1)
          return values.get(0);
        BigInteger total = BigInteger.valueOf(0);
        for (int i = 0; i < values.size(); ++i)
          total = total.add(BigInteger.valueOf(values.get(i)));
        return total.divide(BigInteger.valueOf(values.size())).longValue();
      case MEDIAN:
        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigInteger bi = BigInteger.valueOf(values.get(
                values.size() / 2 - 1));
View Full Code Here

Examples of java.math.BigInteger.divide()

        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigInteger bi = BigInteger.valueOf(values.get(
                values.size() / 2 - 1));
        bi = bi.add(BigInteger.valueOf(values.get(values.size() / 2)));
        return bi.divide(BigInteger.valueOf(2)).longValue();
      case MODE:
        Hashtable<Integer, Integer> map =
            new Hashtable<Integer, Integer>();
        for (int i = 0; i < values.size(); ++i) {
          int prev = 0;
View Full Code Here

Examples of java.math.BigInteger.divide()

        if (values.size() == 1)
          return values.get(0);
        BigInteger total = BigInteger.valueOf(0);
        for (int i = 0; i < values.size(); ++i)
          total = total.add(values.get(i));
        return total.divide(BigInteger.valueOf(values.size()));
      case MEDIAN:
        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigInteger bi = values.get(values.size() / 2 - 1);
        bi = bi.add(values.get(values.size() / 2));
View Full Code Here

Examples of java.math.BigInteger.divide()

      case MEDIAN:
        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigInteger bi = values.get(values.size() / 2 - 1);
        bi = bi.add(values.get(values.size() / 2));
        return bi.divide(BigInteger.valueOf(2));
      case MODE:
        Hashtable<Integer, Integer> map =
            new Hashtable<Integer, Integer>();
        for (int i = 0; i < values.size(); ++i) {
          int prev = 0;
View Full Code Here

Examples of java.math.BigInteger.divide()

        if (values.size() == 1)
          return values.get(0);
        BigInteger total = BigInteger.valueOf(0);
        for (int i = 0; i < values.size(); ++i)
          total = total.add(BigInteger.valueOf(values.get(i)));
        return total.divide(BigInteger.valueOf(values.size())).shortValue();
      case MEDIAN:
        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigInteger bi = BigInteger.valueOf(values.get(
                values.size() / 2 - 1));
View Full Code Here

Examples of java.math.BigInteger.divide()

        if (values.size() % 2 == 1)
          return values.get(values.size() / 2);
        BigInteger bi = BigInteger.valueOf(values.get(
                values.size() / 2 - 1));
        bi = bi.add(BigInteger.valueOf(values.get(values.size() / 2)));
        return bi.divide(BigInteger.valueOf(2)).shortValue();
      case MODE:
        Hashtable<Integer, Integer> map =
            new Hashtable<Integer, Integer>();
        for (int i = 0; i < values.size(); ++i) {
          int prev = 0;
View Full Code Here

Examples of java.math.BigInteger.divide()

        BigInteger expected = BigInteger.valueOf(intMax);
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_SECOND));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_MINUTE));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_HOUR));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_DAY));
        expected = expected.divide(BigInteger.valueOf(DateTimeConstants.MILLIS_PER_WEEK));
        assertTrue(expected.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) < 0);
        assertEquals(expected.longValue(), test.toStandardWeeks().getWeeks());
       
        test = new Period(0, 0, Integer.MAX_VALUE, 7, 0, 0, 0, 0);
        try {
View Full Code Here

Examples of java.math.BigInteger.divide()

        long intMax = Integer.MAX_VALUE;
        BigInteger expected = BigInteger.valueOf(intMax);
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_SECOND));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_MINUTE));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_HOUR));
        expected = expected.divide(BigInteger.valueOf(DateTimeConstants.MILLIS_PER_DAY));
        assertTrue(expected.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) < 0);
        assertEquals(expected.longValue(), test.toStandardDays().getDays());
       
        test = new Period(0, 0, 0, Integer.MAX_VALUE, 24, 0, 0, 0);
        try {
View Full Code Here

Examples of java.math.BigInteger.divide()

        test = new Period(0, 0, 0, 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
        long intMax = Integer.MAX_VALUE;
        BigInteger expected = BigInteger.valueOf(intMax);
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_SECOND));
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_MINUTE));
        expected = expected.divide(BigInteger.valueOf(DateTimeConstants.MILLIS_PER_HOUR));
        assertTrue(expected.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) < 0);
        assertEquals(expected.longValue(), test.toStandardHours().getHours());
       
        test = new Period(0, 0, 0, 0, Integer.MAX_VALUE, 60, 0, 0);
        try {
View Full Code Here

Examples of java.math.BigInteger.divide()

       
        test = new Period(0, 0, 0, 0, 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE);
        long intMax = Integer.MAX_VALUE;
        BigInteger expected = BigInteger.valueOf(intMax);
        expected = expected.add(BigInteger.valueOf(intMax * DateTimeConstants.MILLIS_PER_SECOND));
        expected = expected.divide(BigInteger.valueOf(DateTimeConstants.MILLIS_PER_MINUTE));
        assertTrue(expected.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) < 0);
        assertEquals(expected.longValue(), test.toStandardMinutes().getMinutes());
       
        test = new Period(0, 0, 0, 0, 0, Integer.MAX_VALUE, 60, 0);
        try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.