Tag Archives: Java

When and how much to mix technologies for a project?

The main idea behind using a technology is to harness the power of code re-usability and libraries that have already been worked on and trusted to be working and functional with minimal or no issues. The term “Technology” does not … Continue reading

Posted in Oracle, Oracle ADF, Oracle SQL, OSB, Weblogic | Tagged , , , , , , , , , , | Leave a comment

Util Method to get all attributes printed in System.out.println()

This small util override is to allow developers to view all instance variable values as a CSV format in Java. It is similar to the one seen as var_dump in PHP: @Override public String toString() { Field[] fields = this.getClass().getDeclaredFields(); … Continue reading

Posted in Java | Tagged , , , | Leave a comment

How to Left pad Zeros to integer to get String in Java

The below is the code as to how to add 0 Padding to the left of an integer to format it to string: import java.text.DecimalFormat; public String padZeros(int i) { DecimalFormat df = new DecimalFormat(“00”); return df.format(start); } Change the … Continue reading

Posted in Java | Tagged , , | Leave a comment

How to do an LDAP Search of Various fields

Requirement:┬áretrieving various values such as Description, Office, etc. from LDAP after authentication. An LDAP client retrieves attribute values (referred to as “fields” in the question) by transmitting a search request to the server and then reading the server’s response. A … Continue reading

Posted in LDAP | Tagged , , | Leave a comment

Email Validation

CHALLENGE DESCRIPTION: You are given several strings that may/may not be valid emails. You should write a regular expression that determines if the email id is a valid email id or not. You may assume all characters are from the … Continue reading

Posted in Java | Tagged , , , | Leave a comment

Swaps letters’ case in a sentence. All non-letter characters should remain the same.

INPUT SAMPLE: Your program should accept as its first argument a path to a filename. Input example is the following Hello world! JavaScript language 1.8 A letter OUTPUT SAMPLE: hELLO WORLD! jAVAsCRIPT LANGUAGE 1.8 a LETTER Solution import java.io.BufferedReader; import … Continue reading

Posted in Java | Tagged , | Leave a comment

How to check if 2 Date Ranges Overlap in Java

Code to check if 2 date ranges overlap each other or not. /** * @return boolean true in case the date ranges overlap. */ boolean isOverLaped(Date start1,Date end1,Date start2,Date end2) throws NullPointerException{ if ((start1.before(start2) && end1.after(start2)) || (start1.before(end2) && end1.after(end2)) … Continue reading

Posted in Java | Tagged , , | 8 Comments