String count

Given an integer A,
Find and return (total number of binary strings of length A, without having consecutive 1’s) % 10^9 + 7.

Input Format
The only argument given is integer A.

Output Format
Return  (total number of binary strings of length A, without having consecutive 1's) % 10^9 + 7.

Constraints
1 <= A <= 10^5

For Example
Input 1:
    A = 2
Output 1:
    3
Explanation 1:
    "00"
    "01"
    "10"

Input 2:
    A = 3
Output 2:
    5
Explanation 2:
    "000"
    "001"
    "010"
    "100"
    "101"
Solution:

public class Solution {
    public int solve(int A) {
        int MOD = (int) 1e9 + 7;
        int endingZero = 1;
        int endingOne = 1;
        for (int i = 2; i <= A; i ++) {
            int temp = endingZero;
            endingZero = (endingZero + endingOne) % MOD;
            endingOne = temp;
        }
        return (endingZero + endingOne) % MOD;
    }
}