Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//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);
    }
}