Java

Big Factorial
24-02-2022

This 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 More
Prime Number
24-02-2022

All 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 More
Generate Unique OrderId or TransactionId
08-04-2022

This unique string can be used for generate OrderId or TransactionId.

Read More
Convert UUID To BASE64 and vice-versa
03-06-2022

The programs convert uuidToBase64 and vice-versa.

Read More
JPA Object To ResultSet
22-11-2022

JPA Java Interaction. Get the data and its values without defining model class.

Read More
Read Excel from Java
22-11-2022

Read excel from Java Program and perform your logic.

Read More
Add Days in Calender
16-04-2024

Add days in calender by Amit kumar Giri

Read More