That's right. This behaviour has actually confused me before, as I do most developement in plain java. Thanks, I appreciate your help.

On Mon, Jun 27, 2016 at 2:00 PM, Marshall, Simon <> wrote:

I imagine it’s due to b/100 being a BigDecimal.  See


From: Søren Martin Kristensen []
Sent: 27 June 2016 12:39
Subject: the groovy *= operator differs in behaviour from that of java



I have just realized that *= differs in behaviour between groovy and java. The following source snipletsreturns 7 and 0 for groovy and java, respectively. However, I could not find any description of this in the list of differences between the two languages on


int a = 35;
int b = 20;
a *= b/100;
println a;

This script returns 7


public class test_multiply_operator {
  public static void main(String[] args) throws Exception {
    int a = 35;
    int b = 20;
    a *= b/100;

This java program returns 0. This is because java evaluates the right-hand expression before multiplication.

In case I have not missed something, I guess this would be nice to have on the list of differences between the two languages.

Best regards,



"Misys" is the trade name of the Misys group of companies. This email and any attachments have been scanned for known viruses using multiple scanners. This email message is intended for the named recipient only. It may be privileged and/or confidential. If you are not the named recipient of this email please notify us immediately and do not copy it or use it for any purpose, nor disclose its contents to any other person. This email does not constitute the commencement of legal relations between you and Misys. Please refer to the executed contract between you and the relevant member of the Misys group for the identity of the contracting party with which you are dealing.

Søren Martin Kristensen
Klostergårdsvej 13
DK 3500 Værløse