3:50 pm - Sunday February 19, 7511

Character Example Program for digit(int codePoint,int radix)

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 character program for digit(int codePoint,int radix)in java lang package
/**
 * @author:candidjava.com
 * @description: charcter valid to digit return numeric value radix not valid to
 *               character return -1
**/
public class Digit {
	public static int hexValueOf(char c) {
		return Character.digit(c, 16);
	}

	public static void main(String args[]) {
		// declare a variable
		int j;
		digit a = new digit();
		// find hexvalue of 'c'
		j = a.hexValueOf('c');
		// character not valid digit radix return -1
		System.out.println("Return Value:" + j);
	}
}

OUTPUT:
Return Value:12

Filed in: Z-A All Java Codes

Comments are closed.