Return an array of Palindromes - converting arraylist to array
<p>I have the following code for returning palindromes in an array - the code works fine, but I am actually converting arraylist to an array - as the size is unknown - is this a costly conversion here? what will be the time complexity? new to java coding - wrote code on my own but I am stuck figuring out time complexity for array conversion..</p>

<pre><code>public class palindrome{

public static void main(String[] args){

String[] arr = {"saw","madam","level","taco","tomot"};
String[] res = palind(arr);
System.out.println(java.util.Arrays.toString(res));
}

public static String[] palind(String[] arr){
    int count = 0;
    java.util.ArrayList&lt;String&gt; list = new java.util.ArrayList&lt;String&gt;();
    for(String s : arr){
            if(isPalindrome(s) == true){
                count++;
                list.add(s);
            }
        }
    String[] a = list.toArray(new String[count]);
    return a;
}

public static boolean isPalindrome(String s){
 return s.equals(new StringBuilder(s).reverse().toString());
}
}
</code></pre>