Q:

What is a good IF statement to use in my Appium code

New to the site and still trying to get the hang of asking questions.  
UPDATE
Ok so after making some changes to my code I now have this IF statement in my code, but my problem is if the IF statement is true then it proceeds to that certain page but however won't click on the button.  Is my code correct or am I missing some parts? 
    driver.findElement(By.id(redButton)).click();

    driver.findElement(By.id(good)).click();

    driver.findElement(By.id(locator)).click();

    //IF statement with variable named "viewdets"
    //If "View Details & Pay" button pops up click
    if (! driver.findElements(By.id(viewdets)).isEmpty()) {
        driver.findElement(By.id(viewdets)).click();
        //App Closes and Doesn't Click Pay Button
        driver.findElement(By.id(pay)).click();
        driver.findElement(By.id(conpay)).click();
    //If not then continue to stall and check in
    } else {
        Thread.sleep(7000);
        driver.findElement(By.id(stall)).click();
        driver.findElement(By.id(two)).click();
        driver.findElement(By.id(three)).click();
        driver.findElement(By.id(next)).click();

        wait = new WebDriverWait(driver, 15);
        wait.until(ExpectedConditions.elementToBeClickable(By.id(pay)));

        driver.findElement(By.id(pay)).click();
        driver.findElement(By.id(conpay)).click();
        driver.findElement(By.id(receipt)).click();

A:

You can probably assert that the next expected element is present on the screen or not. 
Assuming the previous two clicks("View Details & Pay" button) if were successful would lead you to this screen or else not. 
org.junit. Assert.assertFalse(driver.findElements(By.id(good)).isEmpty());

validate that there exists an element with id good in the page you have navigated to.  And then perform an action over it as:
driver.findElement(By.id(good)).click();

