Archives: Basics

Java – Calculate Simple Interest

Java Example to Calculate Simple Interest

Simple Interest = (P × R × T) / 100

P — Principal amount
R — rate per annum
T — time in years

Java method to calculate simple interest with given p, r and t values.

Java – Calculate Compound Interest

Java Example to Calculate Compound Interest

Compound Interest = P (1 + R/n) (nt) – P

P — the principal investment amount (the initial deposit or loan amount)
r — the annual interest rate (decimal)
n — the number of times that interest is compounded per unit t
t — the time the money is invested or borrowed for

Java method to calculate compound interest with given P, t, r and n values.

Java – Check Leap Year

Check if given Year is a Leap Year in Java

Java method to check whether given year is a leap year or not