Java tutorial
//package com.java2s; //License from project: Open Source License public class Main { public static int calculateParScore(Double r1, Double r2, int g, int s) { Double score = 0.0; //System.out.println("r1 is " + r1 + " , r2 is " + r2); if (r1 >= r2) { score = s * r2 / r1; } else { score = s + ((r2 - r1) * g / 100); } return score.intValue(); } }