Java Add Int Array Count Function In R