Want to convert JtextArea text to bits String.
I'm using two JTextArea one for input and one for output and one button which is executing following code:
StringBuilder sb = new StringBuilder();
int ssc =Integer.parseInt(jta1.getText());
String sc=Integer.toBinaryString(ssc);
char[] bc=sc.toCharArray();
for (char c : bc) {
sb.append("-");
int i =Character.getNumericValue(c);
String a = String.valueOf(i);
sb.append(a.toString());
jta2.setText(a);
Error
Exception in thread "AWT-EventQueue-0" java.lang.NumberFormatException: For input string: "dsa"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at MainFrame$2.actionPerformed(MainFrame.java:57)