If the given number is in base 2, that means
11100111₂ = 2⁷ + 2⁶ + 2⁵ + 2² + 2 + 1
8 = 2³, and so we have
11100111₂ = 2 • (2³)² + (2³)² + 2² • 2³ + 2² + 2 + 1
11100111₂ = 3 • 8² + 4 • 8 + 7
11100111₂ = 347₈
Because 8 is the 3rd power of 2, we can also split up the given number into block of length up-to 3, then convert each block directly into base 8:
11 100 111
11₂ = 2 + 1 = 3
100₂ = 2² = 4
111₂ = 2² + 2 + 1 = 7
so again we get 347₈.