KnpCode
Java, Spring, BigData, Web development tutorials with examples
 
Skip to content
  • Ubuntu
  • Big Data
    • Hadoop Tutorials
  • Java
    • Core Java Tutorials – Beginner
    • Core Java Tutorials – Advanced
    • Java Programs
  • spring
    • Spring Framework
Home Posts tagged "java-programs" (Page 3)

Tag: java-programs

Shell Sort Java Program

UshaK November 27, 2020 January 7, 2021java-programs java-programs 0

This tutorial shows how to write Shell sort program in Java. Shell sort is also an in place sorting algorithm like Bubble sort, Selection sort but it is faster than these algorithms. Shell sort algorithm Shell sort is based on Insertion sort and it improves on it to make sorting…

Continue reading

Merge Sort Java Program

UshaK November 27, 2020 January 7, 2021java-programs java-programs 0

This tutorial shows how to write Merge sort program in Java. Merge sort is termed as a “divide and conquer algorithm” and it is considered to be more efficient than the simple sort algorithms like selection sort and insertion sort. Merge sort algorithm The algorithm for merge sort is based…

Continue reading

Insertion Sort Java Program

UshaK November 27, 2020 January 7, 2021java-programs java-programs 0

This tutorial shows how to write Insertion sort program in Java. Insertion sort is considered the best among the three simple sorting algorithms,  the other two simple sorting algorithms are Bubble sort and Selection sort. Though the time complexity of Insertion sort is also O(n2) but it is considered much…

Continue reading

Selection Sort Java Program

UshaK November 26, 2020 January 6, 2021java-programs java-programs 0

This post shows how to write Selection sort program in Java. Selection sort is also an in place sorting algorithm like Bubble sort that works by comparing and swapping elements in each pass. Selection sort algorithm Selection sort works as follows- Start with the left most element (index 0) and…

Continue reading

Bubble Sort Java Program

UshaK November 26, 2020 January 6, 2021java-programs java-programs 0

This tutorial shows how to write Bubble sort program in Java. Bubble sort is considered the simplest sorting algorithm out of the three simple sort algorithms, other two being Selection sort and Insertion sort, that work by comparing and swapping elements in each pass. Since there are a large number…

Continue reading

Generic Bubble Sort Java Program

UshaK October 26, 2020 November 16, 2020java-programs Java generics, java-programs 0

In this post we’ll see how to write a Bubble Sort program as a Generic class in Java which can be used with arrays of different data types. Bubble Sort- Java Generic class In the generic class used for Bubble Sort we use a bounded parameter to restrict the type…

Continue reading

How to Convert float to int in Java

UshaK October 23, 2020 January 20, 2021java-programs java-programs 0

In this post we’ll see how to convert float to int in Java. Considerations while converting float to int in Java While converting float to int two things you need to consider are- Range of float is more than the int, if the float you are trying to convert to…

Continue reading

How to Convert String to Byte Array in Java

UshaK October 23, 2020 December 24, 2020java-programs java-programs 3

This post shows how you can convert String to a byte array (Byte[]) in Java. Options for converting String to byte array in Java String class in Java has a getBytes() method to encode String into a sequence of bytes. This method has two overloaded variants too where you can…

Continue reading

How to Convert File to Byte Array in Java

UshaK October 22, 2020 December 23, 2020java-programs java IO, java-programs 0

This post shows different ways to convert file to byte array in Java. You can use read(byte[] b) method of FileInputStream class which reads up to b.length bytes of data from this input stream into byte array. See example. Java 7 onward you can use Files.readAllBytes() method which reads all…

Continue reading

How to Create Temporary File in Java

UshaK October 21, 2020 October 21, 2020java-programs java IO, java-programs 0

Sometimes in your Java application you may want to store some data in a temporary file that can safely be deleted when the work is done. Java IO and NIO APIs itself provide methods to create a temporary file in Java. Table of contents Methods in java.io.File class to create…

Continue reading

‹12345›»
  • String Programs
    Count Number of Words in a String

    Check Given String Palindrome or Not

    Check if The Given Strings Are Anagram or Not

    How to Reverse a String in Java

    Given String Subsequence of Another String in Java
    Number Programs
    Given Number Palindrome or Not

    Java Program to Check Whether Number Prime or Not

    How to Reverse a Number in Java

    Java Program to Display Armstrong Numbers

    Java Program to Find Factorial

    Fibonacci Series Java Program
    Array Programs
    Matrix Multiplication Java Program

    Matrix Addition Java Program

    Matrix Subtraction Java Program

    Remove Element From an Array in Java

    Reverse an Array In-place Java Program
    Java I/O Programs
    How to Read File in Java

    How to Append to a File in Java

    How to Read Delimited File in Java

    How to Read Input From Console in Java

    How to Zip Files in Java

    Creating Password Protected Zip File in Java
    Generate PDF Using Java
    Creating PDF From XML Using Apache FOP

    Generating PDF in Java Using iText

    PDF in Java Using OpenPDF

    Generating PDF in Java Using PDFBox Tutorial

    Convert HTML to PDF in Java Using Openhtmltopdf, PDFBox
    Sorting Programs
    Bubble Sort Java Program

    Selection Sort Java Program

    Insertion Sort Java Program

    Merge Sort Java Program

    Quick Sort Java Program

    Counting Sort Java Program

    Tree Sort Java Program

    Heap Sort Java Program
    Java Date & Time
    Convert Date to String in Java

    Convert String to Date in Java

    Getting Current Date and Time in Java

    Java Date Difference Program
Privacy Policy | Disclaimer
Powered by Nirvana & WordPress.