JAVA DATE TIME API / NOTES</>↗Java Date Time API11 Feb 2016
The following code snippet show you how to find the difference between two time objects represented by LocalTime class. To get the difference between two LocalTime objects we can use the Duration.between() method. This method returns a Duration object, to get the difference in seconds we call the getSeconds() method. Here a code snippet to […]
MAVEN / NOTES</>↗Maven07 Feb 2016
When you need to compile a project for a specific Java version you can configure maven compiler plugin to set the source and the target version. The following pom.xml file configuration show you how to do it. <project> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build> </project> Inva...
CORE API / NOTES</>↗Core API06 Feb 2016
In financial application negative numbers are often represented in parentheses. In this post we will learn how we can parse or convert the negative number in parentheses to produce the represented number value. To parse text / string to a number we can use the java.text.DecimalFormat class. Beside number in parentheses, in this example we […]
APACHE POI / NOTES</>↗Apache POI05 Feb 2016
When I was creating the code snippet for the How do I replace text in Microsoft Word document using Apache POI? I got the following error when running the snippet . As additional information, the code snippet for the Kodejava website is written as a Maven project. org.apache.poi.poifs.filesystem.NotOLE2FileException: Invalid header signature; read 0xE011BDBFEFBDBFEF, expected 0xE11AB1A1E011CFD0 […]
APACHE POI / NOTES</>↗Apache POI05 Feb 2016
The code snippet below show you how you can replace string in Microsoft Word document using the Apache POI library. The class below have three method, the openDocument(), saveDocument() and replaceText(). The routine for replacing text is implemented in the replaceText() method. This method take the HWPFDocument, the String to find and the String to […]
CORE API / NOTES</>↗Core API04 Feb 2016
The code snippet below show us how to display or format negative number in parentheses. We start by defining the number format, the pattern has two parts separated by a semicolon. In the snippet we use the #,##0.00;(#,##0.00) pattern. The pattern after the semicolon will be used to format negative number. Next we create an […]