-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest5.java
More file actions
28 lines (25 loc) · 702 Bytes
/
Copy pathTest5.java
File metadata and controls
28 lines (25 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package programmers;
public class Test5 {
public int solution(String s) {
return Integer.parseInt(s);
}
public static void main(String[] args) {
Test5 alter = new Test5();
System.out.println(alter.solution("123456789"));
// String num = "+12345";
// System.out.println(Integer.parseInt(num));
}
}
//public int getStrToInt(String str) {
// boolean Sign = true;
// int result = 0;
//
// for (int i = 0; i < str.length(); i++) {
// char ch = str.charAt(i);
// if (ch == '-')
// Sign = false;
// else if(ch !='+')
// result = result * 10 + (ch - '0');
// }
// return Sign?1:-1 * result;
//}