can anybody help me what is wrong in syntax of following

ihex=Integer.parseInt(s5,16);
String bin=Integer.toBinaryString(ihex);
System.out.println(bin);
if(bin.length()-10 > 0)
	String orgpc=bin.substring(bin.length()-10);
else
	String orgpc=new String(bin);

this is what compiler shows
nchy@ubuntu:~/Desktop$ javac bpbc.java
bpbc.java:61: error: Syntax error on token "orgpc", delete this token
String orgpc=bin.substring(bin.length()-10);
^^^^^
bpbc.java:63: error: Syntax error, insert "AssignmentOperator Expression" to complete Assignment
String orgpc=new String(bin);
^^^^^^
bpbc.java:63: error: Syntax error, insert ";" to complete Statement
String orgpc=new String(bin);
^^^^^^
3 problems (3 errors)

61 here refers to line 5, and
63 here refers to line 7

Member Avatar for hfx642

Change this to...

ihex=Integer.parseInt(s5,16);
String bin=Integer.toBinaryString(ihex);
System.out.println(bin);
String orgpc;
if(bin.length()-10 > 0)
	orgpc=bin.substring(bin.length()-10);
else
	orgpc=new String(bin);

and see if this helps.

thanks man...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.