Broken Link Checker For A Website Using Java

Broken Link Checker For A Website Using Java explains about how to identify the broken links and images in a website using Java and sitemap.xml.

Broken links and images in yous website reduce your SEO rank. so you need to check the broken links frequently and rectify the errors in order to boost your SEO rank

Below java example, I am showing how to find the broken links and images by reading the sitemap.xml.

Java Batch Update Example With SQL Statement & PreparedStatement

In this example, we are showing how to use Java Batch Update Example With SQL Statement & PreparedStatement

In batch update, update happens on the database as batches, which will increase the processing speed and performance. We can use batch updates for both JDBC Statement & PreparedStatement. You can see the JDBC examples for both Statement & PreparedStatement below.

In this tutorial, we are using H2 database and inserting some data using Java Batch Update

Convert Java Collection / List / String[] Array Into JSON

In this example, we are going to convert a Java collection/list/string[] array into appropriate JSON String using GSON library


I have already written an article about GSON, Convert Java Object To / From JSON, GSON Example, Please see it

Calculate Area / Circumference Of Circle Using Java Math.PI

In this example, we are going to explain the usage of Java Math.PI to calculate area / circumference of circle

On below example, we are using Math.PI for finding the area / circumference of circle.

Formula to find the Area/Circumference are below

Area = radius*radius*PI
Circumference = PI*radius*2

Read File Using Java Scanner Class

Read File Using Java Scanner Class explains about the usage of Java Scanner class API.

while (scnr.hasNextLine()) {
	String line = scnr.nextLine();
	System.out.println( lineNum + " : " + line);

On above code, we are using java.util.Scanner class methods, method scanner.nextLine() is used for reading whole content line by line

Another important method of Scanner class is useDelimiter(), which allows you to change the delimiter accordingly.

Get / Find Package Name Of Java Class

In this tutorial, we are find / get the package name of a Java class by providing the class name using java API.

Package packs = str.getClass().getPackage();

On above code we are using object.getClass().getPackage() method for getting the package name.

Java ProcessBuilder Example

In this Java ProcessBuilder Example, We are showing how to run external programs and operating system commands with the help of ProcessBuilder.

We can use this java API if your JDK is above 1.5.

Each process builder manages these process attributes:

  • command, It is a list of string, each string should be a valid operating system command (see the below example)
  • environment, This will returns a copy of the environment of the current process, we are invoked.
  • working directory, It's current working directory of the process.
  • Input/Output, redirectinput/redirectOutput is for redirecting output to other resources (see the below example)


Get/Find All Months Using Java API

In this example we are showing How To Display all Months Using Java API

DateFormatSymbols is a public class for encapsulating localizable date-time formatting data, such as the names of the months, the names of the days of the week, and the time zone data. DateFormat and SimpleDateFormat both use DateFormatSymbols to encapsulate this information.

Reference ->

Following are the important methods avaialbe on DateFormatSymbols class