I want to make library classes in Java and use them in my future programs. I want these library classes to find primes up to some number or even the next prime number, or you can solve most of the basic things related to primes.
- I have never done a Java library class. I want to know how to do this. Please help me without this by pointing out a textbook or something like that. I am familiar with netbeans IDE.
- I found several algorithms such as Sieve of Eratosthenes and Sieve Atkin . It would be great if you would specify some more such efficient algorithms. I do not want them to be the best, but at least good enough. My goal is to learn a few things by realizing them. Since I have little practical coding experience, I want to do this to improve my skills.
- My friend suggested I use Stream Classes, and he said something about its implementation, providing the output of one file as input to another, to make my code clean. I didn’t understand him very well. Please forgive me if I say something wrong. What I want to ask in this question is that there is an efficient and OO way of doing what I want to do. If yes, please tell me how to do this, and if not, please indicate another way to do this.
I have basic knowledge of the Java language. What I want to achieve through this enterprise is coding experience, because this is what everyone here suggested, "take on such small things and learn on your own"
thanks to all of you in advance
considers
shahensha
EDIT: In the sieve of Eratosthenes and others, we need to store numbers from 2 to n in the data structure. Where should I store it? I know I can use a dynamic collection, but just a small question ... If I want to find prime numbers in billions or more (I will use Big Integer without a doubt), but will all this be stored on the heap correctly? Is there a fear of overflow? Even if this is not good practice? Or would it be better to store numbers or a list (by which we will perform actions depending on the algorithm used) in a file and get access to it? Sorry if my question was too noobish ...
source share