Bandpass general equation to difference equation I know this is a very basic question and I am coming out from a quarter of DSP. I want to create a function in Java which can taken in two parameters, either (double centerFrequency, double bandWidth) or (double startFrequency, double cutoffFrequency).

Based on the information I've gathered, I want a non-ideal IIR filter because this is for a project I am doing with an accelerometer that needs to be updated real-time. Hopefully I am not going too much into programming, but the general form of my filter function would be like this:

double BPFilter(double x, double centerFrequency, double bandWidth) {
    double filteredY;
    static double[] y = {0, 0, 0};
    //y[0] represents y[n]
    //y[1] represents y[n-1]
    //y[2] represents y[n-2]

    y[0] = A*y[2] + B*y[1] + C*x;
    y[2] = y[1];
    y[1] = y[0];
    return y[0];
}


What would be the best way to calculate A, B, and C? Currently I know how to do continuous transfer functions, $H(s)$, so if that is translatable to A, B, and C I could do it that way. The sampling rate is at $100\textrm{ Hz}$.

TL;DR: Discretize a continuous transfer function by hand (no MATLAB)
The transfer function of a continuous-time second-order band-pass filter is given by

$$H(s)=\frac{\frac{\omega_0}{Q}s}{s^2+\frac{\omega_0}{Q}s+\omega_0^2}\tag{1}$$

where $\omega_0$ is the center frequency in radians per second, and $Q$ is the quality factor. For $Q\gg 1$, the term $\omega_0/Q$ closely approximates the $3$ dB bandwidth $W$ (in radians per second). Note that the condition $Q\gg 1$ is equivalent to $W\ll\omega_0$.

If you want to transform the transfer function $(1)$ to the discrete-time domain, there are several possibilities. The two most commonly used ones are the bilinear transform and the impulse invariance method. Both of them are covered extensively in the literature and on the web (including this site). Note that the bilinear transform introduces frequency warping, so you have to pre-warp the parameters of the continuous-time filter in such a way that after the transformation the discrete-time filter has the desired properties. A very good explanation of IIR filter design using the bilinear transform can be found in chapter 11 of the (freely available) book Introduction to Signal Processing by S.J. Orfanidis.

You can find specific formulas for second-order discrete-time filters derived from the bilinear transform in the Audio-EQ-Cookbook. Also take a look at this question and its answers.