private void calculateWeights()
	{
		double tlVar;
		double tlSum=0;
		double pcMean;
		double pcVar;
		double pcSum=0;
		double pcSD;
		double tlSD;
		double coefficientOfVariationPC; //measure of variability of playcounts
		double coefficientOfVariationTL; //measure of variability of time length
		
		
		for(int i=0; i< library.size(); i++)
		{
			if(library.get(i).getTimeLength()>0 && library.get(i).getPlayCount()>1)
			{
				tlSum=tlSum+library.get(i).getTimeLength();
				pcSum=pcSum+library.get(i).getPlayCount();
			}
			
			else
			{
				pcSum=pcSum+0.1;
				oneCount++;
			}
		}
		double denominator= (library.size()-0.9*oneCount);
//		System.out.println(count);
//		System.out.println(tlSum);
		tlMean=tlSum/denominator;
		pcMean=pcSum/denominator;
//		System.out.println(tlMean);
//		System.out.println(pcMean);
		tlSum=0;
		pcSum=0;
		
		for(int i=0; i<library.size(); i++)
		{
			if(library.get(i).getTimeLength()>0 && library.get(i).getPlayCount()>1)
			{
				tlSum+=((library.get(i).getTimeLength()-tlMean)*(library.get(i).getTimeLength()-tlMean));
				pcSum+=((library.get(i).getPlayCount()-pcMean)*(library.get(i).getPlayCount()-pcMean));
			}
			
			else
			{
				tlSum+=tlMean*tlMean*0.1;
				pcSum+=((library.get(i).getPlayCount()-pcMean)*(library.get(i).getPlayCount()-pcMean))*0.1;
			}
		}
		
//		double divisor= library.size()-1; //not sure what is going on here, but it fixed the problem
//		divisor=divisor/(library.size());
//		denominator= denominator*divisor;
		tlVar=tlSum/denominator; 
		pcVar=pcSum/denominator;
		
		tlSD=Math.pow(tlVar, 0.5);
		pcSD=Math.pow(pcVar, 0.5);
//		System.out.println(tlSD);
//		System.out.println(pcSD);
		coefficientOfVariationTL=tlMean/tlSD;
		coefficientOfVariationPC=pcMean/pcSD;
//		System.out.println(coefficientOfVariationTL);
//		System.out.println(coefficientOfVariationPC);
		double ratio=(coefficientOfVariationTL/coefficientOfVariationPC);
//		System.out.println(ratio);
		playCountWeight=(1-dateAddedWeight)/(ratio+1);
		timeLengthWeight=playCountWeight*ratio;
		}