Here you can find the source of divide(int x, int y)
public static int divide(int x, int y)
//package com.java2s; //License from project: Creative Commons License public class Main { public static int divide(int x, int y) { int z = x / y; return z < 0 ? z - 1 : z; }// w ww . j a va2 s . co m }