Well this code worked for me. You can use it to receive and process DynamoDB events in a Lambda function -
public class Handler implements RequestHandler<DynamodbEvent, Void> {
    @Override
    public Void handleRequest(DynamodbEvent dynamodbEvent, Context context) {
        for (DynamodbStreamRecord record : dynamodbEvent.getRecords()) {
            if (record == null) {
                continue;
            }
            // Your code here
            // Write to Table B using DynamoDB Java API
        }
        return null;
    }
}
When you create your Lambda, add the stream from table A as your event source, and that's it.