get mid point between two int - Java java.lang

Java examples for java.lang:int

Description

get mid point between two int

Demo Code

/*******************************************************************************
 * Copyright (C) 2013, 2015 Swirly Cloud Limited. All rights reserved.
 *******************************************************************************/
//package com.java2s;

public class Main {
    public static void main(String[] argv) {
        int lo = 42;
        int hi = 42;
        System.out.println(midpoint(lo, hi));
    }//from   w w  w . j  a  v  a2  s  .  c  o  m

    public static int midpoint(int lo, int hi) {
        return lo + (hi - lo) / 2;
    }
}

Related Tutorials