I personally hate useless comments or comments which state the obvious. If your comments look like these:
/**
* Sets the name of this object to someName.
*/
public void setName(String someName) {
}
Then better remove the comment entirely to save some place. This is really not going to help anybody.
The comment itself if poorly written. But this comment is actually a javadoc, so it is important to include. In fact, it should also have a param tag which describes the purpose of the someName variable. Javadocs can sometimes feel unnecessary for setters and getters, but it is a coding standard because it allows the generation of the API. A developer who is using an API should not have to attempt to guess the purpose of a method, or trace a method, to understand what it does. That information should be clearly stated with javadocs. You can view all the javadoc standards here (there is a lot):
How to Write Doc Comments for the Javadoc Tool
Your second example, is a bit better, but you left out the javadoc tags, which makes the javadocs format better when they are generated:
/**
* Returns the important data that is somehow connected to the given integer and string arguments.
*
* @param anInteger should be within the range [0, getSize()) otherwise an {@link IndexOutOfBoundsException} will be thrown
* @param someParam should not be null, otherwise a {@link NullPointerException} will be thrown
*
* @return a List which contains the important data. The list can be null, unless the method {@link #initialize()} has been invoked beforehand.
*/
public List<?> getImportantData(int anInteger, String someParam) {
}
Also, with regard to HelloWorld's example. This is a good example where you could also include the TODO tag, since the comments are indicating future plans:
public void sort_start(int[] data)
{
// TODO: A simple selection sort.
// for every index in data:
// find the max value between [index, length)
// swap the max value with the value at index
}