<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
Write a code to find the first 4 terms of the Fibonacci sequence in Java.
<|im_end|>
<|im_start|>assistant
public class Fibonacci {
    public static int[] getFibonacciNumbers(int numTerms) { 
        int[] sequence = new int[numTerms]; 
        int firstTerm = 0, secondTerm = 1;		 
        sequence[0] = firstTerm; 
        sequence[1] = secondTerm; 

        for (int i = 2; i < numTerms; i++) {
            sequence[i] = firstTerm + secondTerm; 
            int temp = secondTerm; 
            secondTerm = firstTerm + secondTerm; 
            firstTerm = temp; 
        } 
        return sequence; 
    } 
    
    public static void main(String[] args) 
    { 
        int numTerms = 4; 
        int[] sequence = getFibonacciNumbers(numTerms); 
        System.out.println("The first " + numTerms + " Fibonacci Numbers are:");
        for (int i = 0; i < numTerms; i++) {
            System.out.println(sequence[i]); 
        }
    } 
}<|im_end|>
