How can i use java to automatically remove all empty spaces both starting empty spaces middle empty spaces and ending empty spaces
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SendEmail.aspx.vb" Inherits="SendEmail" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style6" border="1" style="table-layout: auto; border-collapse: separate; empty-cells: show; caption-side: bottom; border: thin inset #000000">
<tr>
<td class="auto-style4" style="border: thin inset #000000; table-layout: auto; border-collapse: separate; border-spacing: 1px;">
<asp:Button Text="Send Email" runat="server" OnClick="OnSendEmail" Height="26px" />
</td>
<td class="auto-style2" style="border: thin inset #000000"><strong>Steps</strong></td>
<td class="auto-style5" style="border: thin inset #000000"> </td>
</tr>
<tr>
<td class="auto-style4" style="border: thin inset #000000; table-layout: auto; border-collapse: separate; border-spacing: 1px;">Email Address</td>
<td colspan="3" rowspan="3" style="border: thin inset #000000"><strong>1.Enter Your Email Address.<br class="auto-style7" />
2. Tick the Lessons you want to Send.<br class="auto-style7" />
3. Click Send Email Button</strong></td>
</tr>
<tr>
<td class="auto-style4" style="border: thin inset #000000; table-layout: auto; border-collapse: separate; border-spacing: 1px;">
<asp:TextBox ID="txtemail" OnTextChanged="txtemail_TextChanged" runat="server" Width="168px"></asp:TextBox>
<br />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage="Invalid email address" ForeColor="Red" ValidationExpression="^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage="Email Required" ForeColor="Red" />
</td>
</tr>
</table>
<br />
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Height="16px" Width="609px" BorderColor="Black">
<Columns>
<asp:BoundField DataField="Name" HeaderText="FileName" />
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields="Id" Text="Download" DataNavigateUrlFormatString="~/FileVB.ashx?Id={0}"
HeaderText="Download" Visible="False" />
<asp:CheckBoxField HeaderText="Tick Topic" />
</Columns>
</asp:GridView>
</form>
</body>
</html>