I am trying to make a program in Java that I need to have handle potentially an infinite length number. I can't just make it a String as I also need to be able to do calculations with it. Right now I am limited by longs but I fear they might not be big enough. Are there other things I could use to have a bigger number?

A double gives you values up to 10**308 on IEEE architecture. The down side is that only about the first 15 digits are precise. So your number is like
3417.51175289137?????????

A high-precision number can give you a value containing several million bits (as integer). You don't get hardware assist in any way, so those computations are slow (really really slow).

You don't have to just do integers. You can use another int with each value to record its exponent (power of 10) but you have to fix up the normalisations yourself.

Some languages (Python, GNU awk, probably Perl) have an arbitrary-precision package, usually using an array of short int. Python switches automatically when any integer result goes over MaxInt. You can understand this as either a long bit array with 15 bits in each short: or as a numeric value held in base-32768. Java should have something equivalent.

Unix/Linux has a dc utility that is limited only by memory. I played with some 5000-digit numbers just to prove I could. You could drive dc down a pipe as a co-process, or at least use it to check all your test cases.

What kind of things are you counting? Long-long (64 bit) gives you about 19-digit integers, which lets you count the World's combined GDP in cents.