Generate UUID or GUID from String in java (with example)

Given an string representing unique identifier. We would like to convert string to corresponding universal unique identifier (UUID) or Globally unique identifier (GUID). We will use java.util.UUID class to create UUID or GUID from string. e.g UUID generateUUID = UUID.fromString(inputUUID) Program: generate UUID or GUID from String in java package org.learn.uuid; import java.util.UUID; public class GenerateUUIDFromString {… Read More »

Generate unique identifier or UUID or GUID in java (with example)

Universal unique identifier (UUID) or Globally unique identifier (GUID) is unique identifier (or Id). GUID represents the unique id(s). Typically UUID is used in following scenarios: UUID is used as a primary key in database Window’s registry is using GUID (or UUID) to uniquely identify (installed) resources. GUID is also used to generate unique name… Read More »

Generate/create random GUID or UUID in java (JUG library/example)

Generate guid or uuid using RandomBasedGenerator class of Java UUID Generator (JUG) library. In current post, we will generate random uuid using JUG library. Generate random UUID using RandomBasedGenerator class in java. Generate custom random UUID using input random number in java. 1. Maven dependency of JUG library <dependency> <groupId>com.fasterxml.uuid</groupId> <artifactId>java-uuid-generator</artifactId> <version>3.1.3</version> </dependency> 2. Generate or… Read More »

Time based uuid generator in java (JUG library / example)

Generate time based uuid in java using JUG (Java Uuid Generator) library. JUG library provides couple of generator viz TimeBasedGenerator & RandomBasedGenerator. In current post, we will demonstrate TimeBasedGenerator of JUG library. Generate time based UUID using TimeBasedGenerator Get the timestamp of generated UUID. Generate custom UUID using network interface. Maven dependency of JUG library <dependency> <groupId>com.fasterxml.uuid</groupId> <artifactId>java-uuid-generator</artifactId> <version>3.1.3</version>… Read More »

Get IP Address from hostname (loopback, local & standard hosts) in java

Given hostname in java, we would like to find out the corresponding IP address. We will discuss out the following scenarios: Input loopback hostname & get corresponding ip address. We will use API InetAddress.getLoopbackAddress() to get loopback address. Input local hostname & get local IP address. We will use API InetAddress.getLocalHost() to get local host… Read More »

List or display contents of compressed or zipped file in java (example)

Given a zipped or compressed file in java. We would like to display or list the contents of zipped file. We will display the name and size of uncompressed files. Program – list or display contents of zipped /compressed file in java package org.learn; import java.io.IOException; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; public class DisplayZipContents {… Read More »

Page 2 of 4112345...102030...Last »