Tag Archives: Util

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

Week of Day String to INT

To change a Day of the week like Monday, Tuesday and so on to integer the use the following code:   public int dayNameComparison(String dayName) { java.text.DateFormatSymbols objDaySymbol = new java.text.DateFormatSymbols(); String symbolDayNames[] = objDaySymbol.getWeekdays(); for (int countDayname = 0; … Continue reading

Posted in Java | Tagged , , | Leave a comment