2:46 am - Friday April 19, 2019

Long Example Program for decode(String nm)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
//Example program for decode(String nm) method
/**
 * @author:candidjava.com
 * @description:program to decode the decimal,hexa and octal values
 */
public class Decode {
	public static void main(String[] args) {
		String decimal = "10"; // Decimal
		String hexa = "0XFF"; // Hexa
		String octal = "077"; // Octal
		// covert decimal val into number using decode() method
		Integer number = Integer.decode(decimal);
		System.out.println("String [" + decimal + "] = " + number);

		number = Integer.decode(hexa);
		System.out.println("String [" + hexa + "] = " + number);

		number = Integer.decode(octal);
		System.out.println("String [" + octal + "] = " + number);
	}
}

OUTPUT:
String [10] =10
String [0xFF] =255
String [077] =63

Filed in: Z-A All Java Codes

Comments are closed.