code: public static byte[] trimRightSpaces(byte[] b_array) {
  		if (b_array == null || b_array.length == 0) {
  			return new byte[0];
  		}
  		int pos = getRightPos(b_array);
  		int length = pos + 1;
  		byte[] newBytes = new byte[length];
  		System.arraycopy(b_array, 0, newBytes, 0, length);
  		return newBytes;
  	}
docs: Trims right spaces from string
  @param b_array the string
  @return the string without right spaces