Java tutorial
//package com.java2s; public class Main { public static int getAbilityModifier(int abilityScore) { double BASE = 10; double calculatedValue = (abilityScore - BASE) / 2; //Force round down is necessary for negative numbers. return (int) Math.floor(calculatedValue); } }