This can be achieved with Custom Format Masks as discussed in another article. We are also providing an alternative method with arithmetic expressions here.
In this example, we are trying to capture version numbers from the MBeans under java.lang:type=Runtime. The values for ManagementSpecVersion and SpecVersion are 1.2 and 1.8 respectively in our case. We can make use of arithmetic expressions for the MBeans.
Case 1: Round down a decimal number
$1.SpecVersion - $1.SpecVersion % 1
Case 2: Round off to the nearest integer
($1.SpecVersion + 0.5) - ($1.SpecVersion + 0.5) % 1
Below is the Active Console output showing the original and rounded values.
The sampler configuration in XML format has been attached as reference.