Hapus spasi di awal dan akhir string java

String withSpaces = "  Hi  ";
String withoutSpaces = withSpaces.trim();
Determined Dingo