Mae sure your method actually does what it says it does.
1: Be very precise. The documentation comments will form a contract between the programmer and the users, so precision is necessary. +1 and *2 are not operators but arithmetical operations. You didn't say whether () are permissible in the formula. 2: Find some resources about documentation comments, e.g. this Oracle page and then later the appropriate part of Effective Java by Joshua Bloch.3: Write the first sentence as a very brief description of the class/method/field/constructor you are describing. maybe, “Calculates the fewest steps needed to change x to y using two arithmetical operations.” It ends at the first full stop. Note short note format. This appears in the “details” section and the summary.4: Write the remainder of the free‑form description, which appears in the “details” section. You are allowed HTML tags, tables, etc. Write as much or as little as you need.5: After the first @ character, you move into tag mode. Use the tags to document parameters, return values, any exceptions known about, etc.I would say that “actions” isn't a good method name for what you are doing. I am not sure it is a good method name for anything, in fact.
Be careful what you write.
Uses Bedžrýczowsky's algorithm.
Uses Bedžrýczowsky's algorithm. See Bedžrýczowsky, A, Acta Pol Math 28: 121-137 (1931)
Uses Bedžrýczowsky's algorithm. See Bedžrýczowsky, A, Acta Pol Math 28: 121-137 (1931). English translation at some link or other.
The current implementation uses Bedžrýczowsky's algorithm. See Bedžrýczowsky, A, Acta Pol Math 28: 121-137 (1931). English translation at some link or other.
The current implementation uses Bedžrýczowsky's algorithm, but this may change in future implementations. See Bedžrýczowsky, A, Acta Pol Math 28: 121-137 (1931). English translation at some link or other.
Each of those comments goes a bit further than its predecessor, but the first three commit you to using Bedžrýczowsky's algorithm for ever. The English translation is useful for people who don't realise that Warsaw was one the world's mathematical centres in the 1930s, and it will tell you whether there really is such a thing as Bedžrýczowsky's algorithm
Your
@param tags should say somewhere that
y must be strictly greater than
x. If you throw an illegal argument exception, that needs a
@throws tags, too.
Please use the
code button to preserve indentation and syntax highlighting.