Java - string split replace and join
<p>I have a URL string where I need to replace the last collection of characters after the final "/"</p>

<p>In Ruby, this would be:</p>

<pre>
str = "/some/url/structure"
ar = str.split("/")
ar[ar.length-1] = "path"
string = ar.join("/")
>> "/some/url/path"
</pre>

<p>How can I do this in Java?</p>
