Here you can find the source of reverse(final String s)
public static String reverse(final String s)
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); public class Main { public static String reverse(final String s) { final StringBuilder builder = new StringBuilder(s); for (int i = 0; i < s.length(); ++i) { builder.setCharAt(i, s.charAt(s.length() - 1 - i)); }// w w w . j a v a2s. c om return builder.toString(); } }