... | ... | @@ -93,25 +93,25 @@ Example of a function: |
|
|
```
|
|
|
class GenerateRandom {
|
|
|
|
|
|
public int generateRandom(int param1, int param2) {
|
|
|
int min = param1;
|
|
|
int max = param2;
|
|
|
public int generateRandom(int param1, int param2) {
|
|
|
int min = param1;
|
|
|
int max = param2;
|
|
|
|
|
|
int random_int = (int)Math.floor(Math.random() * (max - min + 1) + min);
|
|
|
int random_int = (int)Math.floor(Math.random() * (max - min + 1) + min);
|
|
|
|
|
|
return random_int;
|
|
|
}
|
|
|
return random_int;
|
|
|
}
|
|
|
|
|
|
public static void main( String args[] ) {
|
|
|
System.out.println(generateRandom(10, 40));
|
|
|
}
|
|
|
public static void main( String args[] ) {
|
|
|
System.out.println(generateRandom(10, 40));
|
|
|
}
|
|
|
|
|
|
}
|
|
|
```
|
|
|
|
|
|
Use command prettier `--write "**/*.java"` to format code.
|
|
|
|
|
|
- Tabwidth is 2 spaces.
|
|
|
- Tabwidth is 4 spaces.
|
|
|
- Newline before return sequence, unless it is a oneliner.
|
|
|
- Space between arithmetic operators and parameters.
|
|
|
- Space to the write of commas before more parameters.
|
... | ... | |