下面代码哪里出问题了 啊,怎么输出是25}

package isdsa;
class tee
{
public static void main(String [] args)

    {
      int arr[]={3,8,45,586,4,58,5,56,55,6,25};
      String A=shuzu(arr);
      System.out.println(A);
    }

public static String shuzu(int[] arr)
{
    String str="{";
    for(int x=0;x<=arr.length-1;x++)
    {
        if(x<arr.length-1)

        str=str+arr[x]+",";

        else if(x==arr.length-1)

             str=arr[x]+"}";
        }
    return str;
}

}

else if判断里面给str赋值,没加上之前的str。。。。。