Skip to content

Instantly share code, notes, and snippets.

@rabestro
rabestro / README.md
Created May 11, 2020 09:13
For loop and ranges → The roots of equation

There are numbers a,b,c,d. Output in ascending order all the integers between 0 and 1000 (inclusively), which are the roots of the equation

a⋅x^3 + b⋅x^2 + c⋅x + d = 0

If a specified interval does not contain any roots of the equation, do not output anything.

@rabestro
rabestro / EnumToString.java
Last active April 21, 2020 14:30
How to convert Enum to String
import java.util.stream.*;
public class EnumToString {
public static void main(String[] args) {
String colors = Stream.of(MyColors.values())
.map(Enum::toString)
.collect(Collectors.joining(", "));
System.out.println(colors);