Java Double Number Between between(final double zScore, final int firstIndex, final int secondIndex)

Here you can find the source of between(final double zScore, final int firstIndex, final int secondIndex)

Description

Check if zScore is between is between zScorePercentiles[firstIndex] and zScorePercentiles[secondIndex].

License

Open Source License

Parameter

Parameter Description
zScore a parameter
firstIndex a parameter
secondIndex a parameter

Declaration

private static boolean between(final double zScore,
        final int firstIndex, final int secondIndex) 

Method Source Code

//package com.java2s;
/**/*  w  w  w .  ja v a  2s.co  m*/
 * The contents of this file are subject to the OpenMRS Public License
 * Version 1.0 (the "License"); you may not use this file except in
 * compliance with the License. You may obtain a copy of the License at
 * http://license.openmrs.org
 *
 * Software distributed under the License is distributed on an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific language governing rights and limitations
 * under the License.
 *
 * Copyright (C) OpenMRS, LLC.  All Rights Reserved.
 */

public class Main {
    private static final Double[] zScorePercentiles = { -2.326, -2.054,
            -1.881, -1.751, -1.645, -1.555, -1.476, -1.405, -1.341, -1.282,
            -1.227, -1.175, -1.126, -1.08, -1.036, -0.994, -0.954, -0.915,
            -0.878, -0.842, -0.806, -0.772, -0.739, -0.706, -0.674, -0.643,
            -0.613, -0.583, -0.553, -0.524, -0.496, -0.468, -0.44, -0.412,
            -0.385, -0.358, -0.332, -0.305, -0.279, -0.253, -0.228, -0.202,
            -0.176, -0.151, -0.126, -0.1, -0.075, -0.05, -0.025, 0.0,
            0.025, 0.05, 0.075, 0.1, 0.126, 0.151, 0.176, 0.202, 0.228,
            0.253, 0.279, 0.305, 0.332, 0.358, 0.385, 0.412, 0.44, 0.468,
            0.496, 0.524, 0.553, 0.583, 0.613, 0.643, 0.674, 0.706, 0.739,
            0.772, 0.806, 0.842, 0.878, 0.915, 0.954, 0.994, 1.036, 1.08,
            1.126, 1.175, 1.227, 1.282, 1.341, 1.405, 1.476, 1.555, 1.645,
            1.751, 1.881, 2.054, 2.326 };

    /**
     * Check if zScore is between is between zScorePercentiles[firstIndex] and zScorePercentiles[secondIndex].
     *
     * @param zScore
     * @param firstIndex
     * @param secondIndex
     * @return
     */
    private static boolean between(final double zScore,
            final int firstIndex, final int secondIndex) {
        return ((zScore > zScorePercentiles[firstIndex] && zScore <= zScorePercentiles[secondIndex]) || (zScore < zScorePercentiles[firstIndex] && zScore >= zScorePercentiles[secondIndex]));
    }
}

Related

  1. between(double value, double min, double max)
  2. between(double value, double min, double max)
  3. between(double value, double value1, double value2)
  4. between(double value1, double value2, double valueObj)
  5. between(double valueToCompare, double leftBoundary, double rightBoundary, double epsilon)
  6. betweenOrEqual(double max, double min, double val)