Java
Big Factorial
24-02-2022This problem basically asks you to calculate the factorial of a number up to 100. Now, I guess most of you know what a "factorial" is. For those who don't, the factorial of a number N is 1*2*...*N. This problem would be very simple, had it not been for the maximum value of N.Now, the maximum number that we can store in an unsigned 32 bit integer is 2 ^ 32 - 1 and in an unsigned 64 bit integer is 2 ^ 64 - 1. Something like 100!('!' is the notation for factorial) has over 150 decimal digits. The data types mentioned earlier can store numbers having at most 9 and 19 decimal digits respectively. So, we need to find a way to store the 150+ digits that we will get as the answer.
Read MorePrime Number
24-02-2022All programmers came across this program once in their life. Even I also did but I wonder why nobody thought of this. In the prime number everyone creates a loop till the number < number - 1. This is correct but you can write it more efficiently. If you check till number < (number/2) is enough. Don't you think? It's a simple mathematics, a number > (number/2) will never be the multiple of that number.
Read MoreGenerate Unique OrderId or TransactionId
08-04-2022This unique string can be used for generate OrderId or TransactionId.
Read MoreConvert UUID To BASE64 and vice-versa
03-06-2022The programs convert uuidToBase64 and vice-versa.
Read MoreJPA Object To ResultSet
22-11-2022JPA Java Interaction. Get the data and its values without defining model class.
Read More