?>
profile image
Announcements
No new announcements.
mentora icon
bookmark
Table of Contents

    Binary Search in Java Programming

    In this lesson, we will understand what is Binary Search in Java Programming along with some examples.

    What is Binary Search in Java

    A Binary Search is a searching technique used in Java programming to search an element from an array. Binary search only works on sorted arrays.

    Suppose we have a sorted array in ascending order, and we are looking for an element in the array, which is located, at the end of the array. In this case, linear search is not suitable because it will scan each element from the start until it reached the last element that we are searching for in the array. In this situation, Binary Search is a more suitable and efficient searching technique compare to Linear Search.

    In this searching technique, we compare the search element with the middle element of the array. If the search element is greater than the middle element, then we start searching in the right portion of the array after the middle element. If the search element is less then the middle element, then we start searching in the left portion of the array below the middle element. Now we will take only that portion in which the search element may be present and again compare the search element with the middle element of that portion. This process will be in iteration until we find the element, or there is no left or right portion left to search the element.

    To clearly understand the binary search technique, let's go through its algorithm step by step with an example.

    Unlock This Lesson & Start Learning!

    Get full access to this lesson, practical exercises, quizzes, and your Mentora AI Tutor.

    Special Offer, use coupon code DWL6BC to get additional discount of 10% on all subscription. Hurry limited time offer.

    20% off

    1 Month

    ₹323
    ₹259
    Unlock Now

    Renews at ₹259/month.

    Manual renewal required.
    No automatic charges.


    • ✓ Premium lessons access
    • ✓ Quizzes and exercises
    • ✓ Mentora AI Tutor
    32% off

    3 Months

    ₹971
    ₹659
    Unlock Now

    Equivalent to ₹219.67/month.

    Manual renewal required.
    No automatic charges.


    • ✓ Premium lessons access
    • ✓ Quizzes and exercises
    • ✓ Mentora AI Tutor
    40% off

    6 Months

    ₹1942
    ₹1159
    Unlock Now

    Equivalent to ₹193.17/month.

    Manual renewal required.
    No automatic charges.


    • ✓ Premium lessons access
    • ✓ Quizzes and exercises
    • ✓ Mentora AI Tutor
    44% off

    12 Months

    ₹3884
    ₹2159
    Unlock Now

    Equivalent to ₹179.92/month.

    Manual renewal required.
    No automatic charges.


    • ✓ Premium lessons access
    • ✓ Quizzes and exercises
    • ✓ Mentora AI Tutor
    Mentora Question Asked: 0 / 20

    Hi, I’m Mentora!

    I’m your personal AI tutor from Dremendo. Ask me anything, and I’ll help you understand it in a simple and easy way.