Write a function to perform a binary search on a sorted array of integers to find the index of a given target value. If the target is not found in the array, return -1.
- The function should take two inputs: a sorted array of integers and a target integer.
- The function must use the binary search algorithm to find the target.
- Do not use library functions or methods for the binary search; implement the algorithm manually.