Hello Jar

.jar, the wrapped or archived Java application to be used or run on any system with required java run time (JRE). It should have main method, the entry point to start the execution of the application. You can create the jar file with the help of inbuilt Java Archive Tool which is provided in JDK. Continue reading

Number to Binary, Hexa, Octa String

Some times we need the binary, hexadecimal or octal representation of the integer. In java you can easily have this with Integer class in one line. Continue reading

BubbleSort with Java

Bubble sort is one of the easiest algorithms. It simply uses iteration and swapping in it. In this algorithm smaller elements of the array or list  bubbles up to first that’s why it’s named as bubble sort.

Say we have array of {5, 4, 0, 3, 7}, than bubble sort takes first element Continue reading

Text file to String in one line

In Java there are lot of ways to read the files. You can use FileReader, BufferedReader etc. But sometimes you want to read text file and store it directly to the String. For example you have String with numbers which are there to provide some data to your program. Continue reading