Buggy code:
public class RunActivity extends Activity implements WorkoutStateListener { public static final String TAG = "DreamTeen<seq2seq4repair_space>Fitness" ; private static final int REQUEST_OAUTH = 1 ; private static final int WORKOUT_START = 1 ; private static final int WORKOUT_PAUSE = 2 ; private static final int WORKOUT_FINISH = 3 ; private boolean is25notified = false ; private boolean is50notified = false ; private boolean is75notified = false ; private boolean is100notified = false ; private static final String AUTH_PENDING = "auth_state_pending" ; private boolean authInProgress = false ; private GoogleApiClient mClient = null ; private OnDataPointListener mLocationListener ; private OnDataPointListener mStepsListener ; private SharedPreferences mSharedPrefs ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override public void onWorkoutStateChanged ( int state ) { } private void buildFitnessClient ( ) { } private void insertCaloriesAndSteps ( ) { Calendar cal = Calendar . getInstance ( ) ; Date now = new Date ( ) ; cal . setTime ( now ) ; long endTime = cal . getTimeInMillis ( ) ; cal . add ( Calendar . SECOND , ( - 1 ) ) ; long startTime = cal . getTimeInMillis ( ) ; DataSource dataSource = new DataSource . Builder ( ) . setAppPackageName ( this ) . setDataType ( TYPE_CALORIES_EXPENDED ) . setName ( ( ( RunActivity . TAG ) + "<seq2seq4repair_space>-<seq2seq4repair_space>calories<seq2seq4repair_space>expended" ) ) . setType ( TYPE_RAW ) . build ( ) ; float totalDistance = mSharedPrefs . getFloat ( "Distance" , 0 ) ; float caloriesExpanded = ( 132 * 0.63F ) * totalDistance ; DataSet dataSet = DataSet . create ( dataSource ) ; DataPoint dataPoint = dataSet . createDataPoint ( ) . setTimeInterval ( startTime , endTime , TimeUnit . MILLISECONDS ) ; dataPoint . getValue ( FIELD_CALORIES ) . setFloat ( caloriesExpanded ) ; dataSet . add ( dataPoint ) ; HistoryApi . insertData ( mClient , dataSet ) ; dataSource = new DataSource . Builder ( ) . setAppPackageName ( this ) . setDataType ( TYPE_STEP_COUNT_DELTA ) . setName ( ( ( RunActivity . TAG ) + "<seq2seq4repair_space>-<seq2seq4repair_space>step<seq2seq4repair_space>count" ) ) . setType ( TYPE_RAW ) . build ( ) ; <START_BUG> int stepCount = Math . round ( ( totalDistance * 2000 ) ) ; <END_BUG> dataSet = DataSet . create ( dataSource ) ; dataPoint = dataSet . createDataPoint ( ) . setTimeInterval ( startTime , endTime , TimeUnit . MILLISECONDS ) ; dataPoint . getValue ( FIELD_STEPS ) . setInt ( stepCount ) ; dataSet . add ( dataPoint ) ; HistoryApi . insertData ( mClient , dataSet ) ; } private void findLocationDataSources ( ) { } private void registerLocationListener ( DataSource dataSource , final DataType dataType ) { } private void sendLocation ( Double latitude , Double longitude ) { } private void unregisterLocationListener ( ) { } @ Override protected void onActivityResult ( int requestCode , int resultCode , Intent data ) { } @ Override protected void onSaveInstanceState ( Bundle outState ) { } @ Override public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onOptionsItemSelected ( MenuItem item ) { } No newline ; at end ; of file ; }

Fix:
int stepCount = ( ( int ) ( totalDistance ) ) * 2000 ;