How to Convert Lowercase String without API in Java

Convert Lowercase String

#1 Example Code

package com.dineshkrish.string;

public class LowerCaseExample {

	public static void main(String[] args) {

		String strValue = "DINESH KRISHNAN";

		char[] c = strValue.toCharArray();

		String lowerCase = "";

		for (int i = 0; i < c.length; i++) {

			int ascii = c[i];

			if (ascii >= 65 && ascii <= 91) {

				lowerCase = lowerCase + "" + (char) (c[i] + 32) + "";

			} else {

				lowerCase = lowerCase + "" + c[i] + "";
			}

		}

		System.out.println(lowerCase);
	}
}

Output

dinesh krishnan

References

1. Java String API