0

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)

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by nchy13
Featured Replies
  • 1

    Change this to... [CODE]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);[/CODE] and see if this helps. Read More

0

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

1

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.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.