Convert string array to string with separator
Before I review your code I want to point out that Java has a String.join() method which does exactly that. Now to your code:

You use StringBuilder, good. You take care of not appending a seperator after the last and not prepending before the first element, also good. You don't handle null values though, it's your decision if you want to handle them separately or just let Java just throw a NPE. For the separator however, a null appends literally null to the String, I'd rather default to "" if separator is null. A way to get rid of the flag:

public String getArrayAsString(String[] stringArray, String separator) {
    if(stringArray == null || stringArray.length == 0) return "";


With this we already ensured that our stringArray has at least one entry. What we can do now is initialize the StringBuilder with the first String:

    StringBuilder finalString = new StringBuilder(stringArray[0]);


Since all strings after the first one need to prepend the separator, we don't need the flag anymore. Unfortunately, we can't use a foreach loop, since we have to start at index 1 as the element at index 0 is already in the StringBuilder:

    for(int i = 1; i &lt; stringArray.length; ++i)
        finalString.append(separator).append(stringArray[i]);


And then just return what we got:

    return finalString.toString();


Whole function:

public String getArrayAsString(String[] stringArray, String separator) {
    if(stringArray == null || stringArray.length == 0) return "";

    StringBuilder finalString = new StringBuilder(stringArray[0]);

    for(int i = 1; i &lt; stringArray.length; ++i)
        finalString.append(separator).append(stringArray[i]);

    return finalString.toString();
}


Edit:

In String.join() the parameters are swapped, so the separator comes first, the array second:

    String[] arr = new String[]{"Hello", "World"};
    System.out.println(String.join(" | ", arr));
    System.out.println(getArrayAsString(arr, " | ")); //Your function


Output:

Hello | World
Hello | World


Working code at ideone.com