code: public static double xbarVariance(double variance, int sampleN, int populationN) {
          if(populationN<=0 || sampleN<=0 || sampleN>populationN) {
              throw new IllegalArgumentException("All the parameters must be positive and sampleN smaller than populationN.");
          }
          
          double xbarVariance=(1.0 - (double)sampleN/populationN)*variance/sampleN;
          
          return xbarVariance;
      }
docs: Calculates Variance for Xbar for a finite population size
  
  @param variance
  @param sampleN
  @param populationN
  @return