I have a string of chars and integers which I am splitting to take out the negative integer value and then check if the value is negative, then do something inside if block. Code sample is as below:
java.util.Iterator<WebElement> i = elements.iterator();
while (i.hasNext()) {
WebElement element = i.next();
String str = element.getAttribute("name");
System.out.println(str);
String[] arrOfStr = str.split("_");
System.out.println(arrOfStr);
long res = Integer.parseInt(arrOfStr[1]);
System.out.println(res);
if (res < 0) {
System.out.println("Inside if");
System.out.println(data);
Thread.sleep(10000);
Select selectBox = new Select(element);
selectBox.selectByVisibleText(data);
}