Skip to content

Instantly share code, notes, and snippets.

View yogeshjoshi's full-sized avatar

YOGESH JOSHI yogeshjoshi

View GitHub Profile
MyPizza myPizza = new MyPizza.Builder()
.setSize(10)
.setPepperoni(true);
.setBacon(true)
.setVeggies(true)
.setBlackPepper(true)
.build();
Public class MyPizza{
private int size;
private boolean cheese;
private boolean pepperoni;
private boolean bacon;
private boolean veggies;
private boolean blackPepper;
public MyPizza(int size,boolean cheese, boolean pepperoni, boolean bacon, boolean veggies, boolean blackPepper){
this.size = size;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
Public class MyPizza{
private int size;
private boolean cheese;
private boolean pepperoni;
private boolean bacon;
public void MyPizza(){
MyPizza mypizza = new MyPizza(12);
mypizza.setCheese(true);
mypizza.setPepperoni(true);
mypizza.setBacon(true);
MyPizza(int size) { ... }
MyPizza(int size, boolean cheese) { ... }
MyPizza(int size, boolean cheese, boolean pepperoni) { ... }
MyPizza(int size, boolean cheese, boolean pepperoni, boolean bacon) { ... }
MyPizza(int size, boolean cheese, boolean pepperoni, boolean bacon, boolean veggisAllowed) { ... }
int mid = low + ((high - low) / 2);
int mid = (low + high) / 2;
public static int binarySearch(int[] a, int key) {
int low = 0;
int high = a.length - 1;
while (low <= high) {
int mid = (low + high) / 2;
int midVal = a[mid];
if (midVal < key)
low = mid + 1
else if (midVal > key)
high = mid - 1;