JAVA
Code


# Code
```java []
public class Solution {
    public int sumOfFlooredPairs(int[] nums) {
        int N = (int) 1e5; // Maximum possible value in nums
        int mod = (int) 1e9 + 7; // Modulo value

        // Step 1: Create a frequency map to count occurrences of each number
        int[] frequencyMap = new int[N + 1];
        for (int num : nums) {
            frequencyMap[num]++;
        }

        // Step 2: Create a prefix sum array for the frequency map
        int[] prefixFreq = new int[N + 1];
        for (int i = 1; i <= N; i++) {
            prefixFreq[i] = prefixFreq[i - 1] + frequencyMap[i];
        }

        long total = 0; // Variable to store the final result

        // Step 3: Iterate through all possible numbers in the frequency map
        for (int i = 1; i <= N; i++) {
            if (frequencyMap[i] == 0) continue; // Skip if the number doesn't exist in nums

            long sum = 0; // Variable to store the sum of floor divisions for the current number i

            // Step 4: Iterate through all multiples of i
            for (int j = 1; i * j <= N; j++) {
                int lower = i * j - 1; // Lower bound of the range
                int upper = i * (j + 1) - 1; // Upper bound of the range

                // Step 5: Calculate the count of numbers in the range [lower + 1, upper]
                int count = prefixFreq[Math.min(N, upper)] - prefixFreq[lower];

                // Step 6: Add the contribution of this range to the sum
                sum += (long) count * j;
            }

            // Step 7: Multiply the sum by the frequency of i and add it to the total
            total = (total + (sum % mod) * frequencyMap[i]) % mod;
        }

        return (int) total; // Return the result modulo 1e9 + 7
    }
}
```
['Java']